]> granicus.if.org Git - php/commitdiff
MFB: Last set of zend_hash_init() optimizations
authorIlia Alshanetsky <iliaa@php.net>
Tue, 3 Oct 2006 19:52:34 +0000 (19:52 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 3 Oct 2006 19:52:34 +0000 (19:52 +0000)
ext/soap/php_schema.c
ext/soap/soap.c
ext/sockets/sockets.c
main/streams/filter.c
main/streams/streams.c

index a5b6d5cca2c02338cc5f0278976cb0cae789e839..1721905d15bb550b31dcf3d3e6f4a945573beb25 100644 (file)
@@ -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;
                                                        }
index 8ed54f54b9e161a4d546d21df33ae029197c8086..80bcfd0a27f08008dfc463a6813b30e360228a8a 100644 (file)
@@ -1366,7 +1366,7 @@ PHP_METHOD(SoapServer, SoapServer)
                        zval *ztmp;
 
                        ALLOC_HASHTABLE(service->class_map);
-                       zend_u_hash_init(service->class_map, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
+                       zend_u_hash_init(service->class_map, zend_hash_num_elements((*tmp)->value.ht), NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
                        zend_hash_copy(service->class_map, (*tmp)->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &ztmp, sizeof(zval *));
                }
 
index 3ae8c2b7dc1719be1d71653a67d2c0d06d526945..37c9af90cd2c4306cecab840d7a4988dcddbe933 100644 (file)
@@ -566,7 +566,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))) {
index 935af34f593e4279078162bbf3d0159c41a1ebbc..0bfd7fa853b60ed726a65ef490e11cfcc0a96516 100644 (file)
@@ -61,7 +61,7 @@ PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern
                php_stream_filter_factory tmpfactory;
 
                ALLOC_HASHTABLE(FG(stream_filters));
-               zend_hash_init(FG(stream_filters), 0, NULL, NULL, 1);
+               zend_hash_init(FG(stream_filters), zend_hash_num_elements(&stream_filters_hash), NULL, NULL, 1);
                zend_hash_copy(FG(stream_filters), &stream_filters_hash, NULL, &tmpfactory, sizeof(php_stream_filter_factory));
        }
 
index 6fcff4a217cb7495f970690b50a92a6e35ac2857..0ec9a7ee31a1db47625b62c687920c5908d963f0 100755 (executable)
@@ -2010,7 +2010,7 @@ static void clone_wrapper_hash(TSRMLS_D)
        php_stream_wrapper *tmp;
 
        ALLOC_HASHTABLE(FG(stream_wrappers));
-       zend_hash_init(FG(stream_wrappers), 0, NULL, NULL, 1);
+       zend_hash_init(FG(stream_wrappers), zend_hash_num_elements(&url_stream_wrappers_hash), NULL, NULL, 1);
        zend_hash_copy(FG(stream_wrappers), &url_stream_wrappers_hash, NULL, &tmp, sizeof(tmp));
 }