]> granicus.if.org Git - php/commitdiff
Calculate hash value once
authorDmitry Stogov <dmitry@php.net>
Wed, 8 Apr 2009 13:18:15 +0000 (13:18 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 8 Apr 2009 13:18:15 +0000 (13:18 +0000)
Zend/zend_execute_API.c

index 2042a19a445b2a0874ba3234e612ee7264cca1d1..8901dc7d7000dc878ba2e2ae87613321959add62 100644 (file)
@@ -1063,6 +1063,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length,
        char dummy = 1;
        zend_fcall_info fcall_info;
        zend_fcall_info_cache fcall_cache;
+       ulong hash;
 
        if (name.v == NULL || !name_length) {
                return FAILURE;
@@ -1086,7 +1087,9 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length,
                lc_name_len -= 1;
        }
 
-       if (zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len + 1, (void **) ce) == SUCCESS) {
+       hash = zend_u_inline_hash_func(type, lc_name, lc_name_len + 1);
+
+       if (zend_u_hash_quick_find(EG(class_table), type, lc_name, lc_name_len + 1, hash, (void **) ce) == SUCCESS) {
                if (do_normalize) {
                        efree(lc_free.v);
                }
@@ -1108,7 +1111,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length,
                zend_u_hash_init(EG(in_autoload), 0, NULL, NULL, 0, UG(unicode));
        }
 
-       if (zend_u_hash_add(EG(in_autoload), type, lc_name, lc_name_len + 1, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
+       if (zend_u_hash_quick_add(EG(in_autoload), type, lc_name, lc_name_len + 1, hash, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
                if (do_normalize) {
                        efree(lc_free.v);
                }
@@ -1149,7 +1152,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length,
 
        zval_ptr_dtor(&class_name_ptr);
 
-       zend_u_hash_del(EG(in_autoload), type, lc_name, lc_name_len + 1);
+       zend_u_hash_quick_del(EG(in_autoload), type, lc_name, lc_name_len + 1, hash);
 
        if (retval_ptr) {
                zval_ptr_dtor(&retval_ptr);
@@ -1162,7 +1165,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length,
                return FAILURE;
        }
 
-       retval = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len + 1, (void **) ce);
+       retval = zend_u_hash_quick_find(EG(class_table), type, lc_name, lc_name_len + 1, hash, (void **) ce);
        if (do_normalize) {
                efree(lc_free.v);
        }