cvs: php4 /ext/standard var.c
| From: | Thies C. Arntzen | Date: | Sun, 18 Jun 2000 10:25:39 +0000 |
| Subject: | cvs: php4 /ext/standard var.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-353@lists.php.net to get a copy of this message | ||
thies Sun Jun 18 03:25:39 2000 EDT
Modified files:
/php4/ext/standard var.c
Log:
(serialize) no longer touches the internal array-pointer
Index: php4/ext/standard/var.c
diff -u php4/ext/standard/var.c:1.64 php4/ext/standard/var.c:1.65
--- php4/ext/standard/var.c:1.64 Sat Jun 17 09:49:03 2000
+++ php4/ext/standard/var.c Sun Jun 18 03:25:39 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.64 2000/06/17 16:49:03 zeev Exp $ */
+/* $Id: var.c,v 1.65 2000/06/18 10:25:39 thies Exp $ */
/* {{{ includes
@@ -209,7 +209,7 @@
res = call_user_function_ex(CG(function_table), *struc, fname, &retval_ptr, 0, 0, 1,
NULL);
- if ((res == SUCCESS)) {
+ if (res == SUCCESS) {
if (retval_ptr && HASH_OF(retval_ptr)) {
int count = zend_hash_num_elements(HASH_OF(retval_ptr));
slen = sprintf(s,
"O:%d:\"%s\":%d:{",(*struc)->value.obj.ce->name_length,(*struc)->value.obj.ce->name,
count);
@@ -218,14 +218,15 @@
char *key;
zval **d,**name;
ulong index;
+ HashPosition pos;
- zend_hash_internal_pointer_reset(HASH_OF(retval_ptr));
- for (;; zend_hash_move_forward(HASH_OF(retval_ptr))) {
- if ((i = zend_hash_get_current_key(HASH_OF(retval_ptr), &key, &index)) ==
HASH_KEY_NON_EXISTANT) {
+ zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr),&pos);
+ for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr),&pos)) {
+ if ((i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr), &key, NULL, &index,
&pos)) == HASH_KEY_NON_EXISTANT) {
break;
}
- zend_hash_get_current_data(HASH_OF(retval_ptr), (void **) (&name));
+ zend_hash_get_current_data_ex(HASH_OF(retval_ptr), (void **) (&name), &pos);
if ((*name)->type != IS_STRING) {
php_error(E_NOTICE, "__sleep should return an array only containing the names of
instance-variables to serialize.");
@@ -246,8 +247,7 @@
FREE_ZVAL(fname);
if (retval_ptr) {
- zval_dtor(retval_ptr);
- FREE_ZVAL(retval_ptr);
+ zval_ptr_dtor(&retval_ptr);
}
goto std_array;
}
@@ -255,8 +255,9 @@
zval_dtor(fname);
FREE_ZVAL(fname);
- if (retval_ptr)
+ if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
+ }
return;
}
@@ -274,13 +275,14 @@
char *key;
pval **data,*d;
ulong index;
+ HashPosition pos;
- zend_hash_internal_pointer_reset(myht);
- for (;; zend_hash_move_forward(myht)) {
- if ((i = zend_hash_get_current_key(myht, &key, &index)) == HASH_KEY_NON_EXISTANT) {
+ zend_hash_internal_pointer_reset_ex(myht, &pos);
+ for (;; zend_hash_move_forward_ex(myht, &pos)) {
+ if ((i = zend_hash_get_current_key_ex(myht, &key, NULL, &index, &pos)) ==
HASH_KEY_NON_EXISTANT) {
break;
}
- if (zend_hash_get_current_data(myht, (void **) (&data)) != SUCCESS || !data || ((*data) ==
(*struc))) {
+ if (zend_hash_get_current_data_ex(myht, (void **) (&data), &pos) != SUCCESS || !data
|| ((*data) == (*struc))) {
if (i == HASH_KEY_IS_STRING)
efree(key);
continue;