cvs: php4 /ext/standard string.c
| From: | Thies C. Arntzen | Date: | Sun, 18 Jun 2000 10:37:01 +0000 |
| Subject: | cvs: php4 /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-354@lists.php.net to get a copy of this message | ||
thies Sun Jun 18 03:37:01 2000 EDT
Modified files:
/php4/ext/standard string.c
Log:
(implode), (strtr) no longer touch the internal array-pointer.
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.131 php4/ext/standard/string.c:1.132
--- php4/ext/standard/string.c:1.131 Sat Jun 17 09:49:03 2000
+++ php4/ext/standard/string.c Sun Jun 18 03:37:01 2000
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.131 2000/06/17 16:49:03 zeev Exp $ */
+/* $Id: string.c,v 1.132 2000/06/18 10:37:01 thies Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -289,25 +289,26 @@
{
zval **tmp;
int len = 0, count = 0, target = 0;
+ HashPosition pos;
/* convert everything to strings, and calculate length */
- zend_hash_internal_pointer_reset(arr->value.ht);
- while (zend_hash_get_current_data(arr->value.ht, (void **) &tmp) == SUCCESS) {
+ zend_hash_internal_pointer_reset_ex(arr->value.ht, &pos);
+ while (zend_hash_get_current_data_ex(arr->value.ht, (void **) &tmp, &pos) == SUCCESS) {
convert_to_string_ex(tmp);
len += (*tmp)->value.str.len;
if (count>0) {
len += delim->value.str.len;
}
count++;
- zend_hash_move_forward(arr->value.ht);
+ zend_hash_move_forward_ex(arr->value.ht, &pos);
}
/* do it */
return_value->value.str.val = (char *) emalloc(len + 1);
return_value->value.str.val[0] = '\0';
return_value->value.str.val[len] = '\0';
- zend_hash_internal_pointer_reset(arr->value.ht);
- while (zend_hash_get_current_data(arr->value.ht, (void **) &tmp) == SUCCESS) {
+ zend_hash_internal_pointer_reset_ex(arr->value.ht, &pos);
+ while (zend_hash_get_current_data_ex(arr->value.ht, (void **) &tmp, &pos) == SUCCESS) {
count--;
memcpy(return_value->value.str.val + target, (*tmp)->value.str.val,
(*tmp)->value.str.len);
@@ -317,7 +318,7 @@
delim->value.str.len);
target += delim->value.str.len;
}
- zend_hash_move_forward(arr->value.ht);
+ zend_hash_move_forward_ex(arr->value.ht, &pos);
}
return_value->type = IS_STRING;
return_value->value.str.len = len;
@@ -1196,10 +1197,11 @@
int minlen = 128*1024;
int maxlen = 0, pos, len, newpos, newlen, found;
char *newstr, *key;
+ HashPosition hpos;
- zend_hash_internal_pointer_reset(hash);
- while (zend_hash_get_current_data(hash, (void **)&entry) == SUCCESS) {
- switch (zend_hash_get_current_key(hash, &string_key, &num_key)) {
+ zend_hash_internal_pointer_reset_ex(hash, &hpos);
+ while (zend_hash_get_current_data_ex(hash, (void **)&entry, &hpos) == SUCCESS) {
+ switch (zend_hash_get_current_key_ex(hash, &string_key, NULL, &num_key, &hpos)) {
case HASH_KEY_IS_STRING:
len = strlen(string_key);
if (len > maxlen) maxlen = len;
@@ -1219,7 +1221,7 @@
if (len < minlen) minlen = len;
break;
}
- zend_hash_move_forward(hash);
+ zend_hash_move_forward_ex(hash, &hpos);
}
key = emalloc(maxlen+1);