CVS update: php3/functions
| From: | steinm | Date: | Tue, 13 Apr 1999 14:32:32 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5030@lists.php.net to get a copy of this message | ||
Date: Tuesday April 13, 1999 @ 10:32
Author: steinm
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv6040/functions
Modified Files:
hw.c
Log Message:
fixed bug in hw_array2objrec()
Index: php3/functions/hw.c
diff -c php3/functions/hw.c:1.27 php3/functions/hw.c:1.28
*** php3/functions/hw.c:1.27 Thu Apr 8 11:08:13 1999
--- php3/functions/hw.c Tue Apr 13 10:32:31 1999
***************
*** 23,29 ****
+----------------------------------------------------------------------+
*/
! /* $Id: hw.c,v 1.27 1999/04/08 15:08:13 steinm Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
#endif
--- 23,29 ----
+----------------------------------------------------------------------+
*/
! /* $Id: hw.c,v 1.28 1999/04/13 14:32:31 steinm Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
#endif
***************
*** 366,371 ****
--- 366,403 ----
case IS_LONG:
sprintf(str, "%s=0x%lX\n", key, keydata->value.lval);
break;
+ case IS_ARRAY: {
+ int i, len, keylen, count;
+ char *strarr, *ptr, *ptr1;
+ count = _php3_hash_num_elements(keydata->value.ht);
+ if(count > 0) {
+ strarr = make_objrec_from_array(keydata->value.ht);
+ len = strlen(strarr) - 1;
+ keylen = strlen(key);
+ if(NULL == (ptr = malloc(len + 1 + count*(keylen+1)))) {
+ free(objrec);
+ return(NULL);
+ }
+ ptr1 = ptr;
+ *ptr1 = '\0';
+ strcpy(ptr1, key);
+ ptr1 += keylen;
+ *ptr1++ = '=';
+ for(i=0; i<len; i++) {
+ *ptr1++ = strarr[i];
+ if(strarr[i] == '\n') {
+ strcpy(ptr1, key);
+ ptr1 += keylen;
+ *ptr1++ = '=';
+ } else if(strarr[i] == '=')
+ ptr1[-1] = ':';
+ }
+ *ptr1++ = '\n';
+ *ptr1 = '\0';
+ strncpy(str, ptr, 1023);
+ }
+ break;
+ }
}
efree(key);
objrec = realloc(objrec, strlen(objrec)+strlen(str)+1);
***************
*** 3008,3014 ****
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
}
! convert_to_string(arg1);
objrec = make_objrec_from_array(arg1->value.ht);
if(objrec) {
retobj = estrdup(objrec);
--- 3040,3046 ----
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
}
! convert_to_array(arg1);
objrec = make_objrec_from_array(arg1->value.ht);
if(objrec) {
retobj = estrdup(objrec);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net