summaryrefslogtreecommitdiff
path: root/Zend/zend_hash.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-12-22 12:49:51 +0000
committerZeev Suraski <zeev@php.net>2000-12-22 12:49:51 +0000
commit36eaad252fc5fe292cd4f071f76e7879ce21130c (patch)
tree5b5f4c0f06122a3ac45c6414f3ab1d778027cc9c /Zend/zend_hash.c
parent0fcce4a77a4783bb2366d562d957da5a9249134f (diff)
downloadphp-git-36eaad252fc5fe292cd4f071f76e7879ce21130c.tar.gz
Allow get_current_key() not to return the key itself, instead of a duplicate
Diffstat (limited to 'Zend/zend_hash.c')
-rw-r--r--Zend/zend_hash.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index dc5b4d2a7a..16a9080cd1 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -1019,7 +1019,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
/* This function should be made binary safe */
-ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, HashPosition *pos)
+ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)
{
Bucket *p;
@@ -1029,9 +1029,10 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong
if (p) {
if (p->nKeyLength) {
- *str_index = (char *) estrndup(p->arKey, p->nKeyLength);
- if (ht->persistent) {
- persist_alloc(*str_index);
+ if (duplicate) {
+ *str_index = estrndup(p->arKey, p->nKeyLength);
+ } else {
+ *str_index = p->arKey;
}
if (str_length) {
*str_length = p->nKeyLength;