summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-10-03 19:51:01 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-10-03 19:51:01 +0000
commit557838efa45f2b23ce2a17b5b54c2e8d22f1336d (patch)
treeb113eace1ef6e8f16eba27ba746585c9213366f4 /ext
parent8e1c9371bbc68d433702b9a7e647c7ad268b050c (diff)
downloadphp-git-557838efa45f2b23ce2a17b5b54c2e8d22f1336d.tar.gz
Last set of zend_hash_init() optimizations
Diffstat (limited to 'ext')
-rw-r--r--ext/soap/php_schema.c4
-rw-r--r--ext/soap/soap.c4
-rw-r--r--ext/sockets/sockets.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 9040eec57d..896ea6313a 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -2039,7 +2039,7 @@ static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
xmlNodePtr node;
attr->extraAttributes = emalloc(sizeof(HashTable));
- zend_hash_init(attr->extraAttributes, 0, NULL, delete_extra_attribute, 0);
+ zend_hash_init(attr->extraAttributes, zend_hash_num_elements((*tmp)->extraAttributes), NULL, delete_extra_attribute, 0);
zend_hash_copy(attr->extraAttributes, (*tmp)->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr));
}
attr->encode = (*tmp)->encode;
@@ -2085,7 +2085,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
if (newAttr->extraAttributes) {
xmlNodePtr node;
HashTable *ht = emalloc(sizeof(HashTable));
- zend_hash_init(ht, 0, NULL, delete_extra_attribute, 0);
+ zend_hash_init(ht, zend_hash_num_elements(newAttr->extraAttributes), NULL, delete_extra_attribute, 0);
zend_hash_copy(ht, newAttr->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr));
newAttr->extraAttributes = ht;
}
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index c17f9aefb4..dcaa51683c 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1078,7 +1078,7 @@ PHP_METHOD(SoapServer, SoapServer)
zval *ztmp;
ALLOC_HASHTABLE(service->class_map);
- zend_hash_init(service->class_map, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(service->class_map, zend_hash_num_elements((*tmp)->value.ht), NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(service->class_map, (*tmp)->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &ztmp, sizeof(zval *));
}
@@ -1323,7 +1323,7 @@ PHP_METHOD(SoapServer, addFunction)
if (service->soap_functions.ft == NULL) {
service->soap_functions.functions_all = FALSE;
service->soap_functions.ft = emalloc(sizeof(HashTable));
- zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(service->soap_functions.ft, zend_hash_num_elements(Z_ARRVAL_P(function_name)), NULL, ZVAL_PTR_DTOR, 0);
}
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(function_name), &pos);
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index f76139e0fe..db08598cbc 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -568,7 +568,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC)
if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0;
ALLOC_HASHTABLE(new_hash);
- zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_init(new_hash, zend_hash_num_elements(Z_ARRVAL_P(sock_array)), NULL, ZVAL_PTR_DTOR, 0);
for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(sock_array));
zend_hash_get_current_data(Z_ARRVAL_P(sock_array), (void **) &element) == SUCCESS;
zend_hash_move_forward(Z_ARRVAL_P(sock_array))) {