summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2000-09-28 15:17:50 +0000
committerStanislav Malyshev <stas@php.net>2000-09-28 15:17:50 +0000
commit56c474cf48344b040891f2618d33ef09a0e8be7e (patch)
tree2ac7a977e2e5cfd85d98f623859eed7e50ab3d37
parent7a4e086d7a72fe842f7ce945e74d1abfde5e7a5c (diff)
downloadphp-git-56c474cf48344b040891f2618d33ef09a0e8be7e.tar.gz
Make hash_copy call copy constructor on a real copy, not on a temp
-rw-r--r--Zend/zend_hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 88dd1cc0f0..280fc0b679 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -750,21 +750,21 @@ ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, int (*destruct)(void
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size)
{
Bucket *p;
+ void *new_entry;
IS_CONSISTENT(source);
IS_CONSISTENT(target);
p = source->pListHead;
while (p) {
- memcpy(tmp, p->pData, size);
- if (pCopyConstructor) {
- pCopyConstructor(tmp);
- }
if (p->nKeyLength) {
- zend_hash_update(target, p->arKey, p->nKeyLength, tmp, size, NULL);
+ zend_hash_update(target, p->arKey, p->nKeyLength, p->pData, size, &new_entry);
} else {
- zend_hash_index_update(target, p->h, tmp, size, NULL);
+ zend_hash_index_update(target, p->h, p->pData, size, &new_entry);
}
+ if (pCopyConstructor) {
+ pCopyConstructor(new_entry);
+ }
p = p->pListNext;
}
target->pInternalPointer = target->pListHead;