iliaa           Wed Dec 13 15:31:47 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       basic_functions.c 
    /php-src/ext/wddx   wddx.c 
  Log:
  optimize out strlen() calls
  
  # Patch by Matt Wilmas
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.34&r2=1.725.2.31.2.35&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.34 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.35
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.34      Sun Dec 10 
01:23:41 2006
+++ php-src/ext/standard/basic_functions.c      Wed Dec 13 15:31:47 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.34 2006/12/10 01:23:41 edink Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.35 2006/12/13 15:31:47 iliaa Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -4665,13 +4665,13 @@
                        }
                } else {
                        /* other strings */
-                       if(zend_hash_find(HASH_OF(return_value), optname, 
strlen(optname)+1, (void **)&args) != FAILURE) {
+                       if(zend_hash_find(HASH_OF(return_value), optname, 
optname_len + 1, (void **)&args) != FAILURE) {
                                if(Z_TYPE_PP(args) != IS_ARRAY) {
                                        convert_to_array_ex(args);
                                } 
                                zend_hash_next_index_insert(HASH_OF(*args),  
(void *)&val, sizeof(zval *), NULL);
                        } else {
-                               zend_hash_add(HASH_OF(return_value), optname, 
strlen(optname)+1, (void *)&val, sizeof(zval *), NULL);
+                               zend_hash_add(HASH_OF(return_value), optname, 
optname_len + 1, (void *)&val, sizeof(zval *), NULL);
                        }
                }
        }
http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/wddx.c?r1=1.119.2.10.2.6&r2=1.119.2.10.2.7&diff_format=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.119.2.10.2.6 
php-src/ext/wddx/wddx.c:1.119.2.10.2.7
--- php-src/ext/wddx/wddx.c:1.119.2.10.2.6      Wed Aug  2 22:03:47 2006
+++ php-src/ext/wddx/wddx.c     Wed Dec 13 15:31:47 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: wddx.c,v 1.119.2.10.2.6 2006/08/02 22:03:47 tony2001 Exp $ */
+/* $Id: wddx.c,v 1.119.2.10.2.7 2006/12/13 15:31:47 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -974,10 +974,11 @@
                                                add_property_zval(ent2->data, 
ent1->varname, ent1->data);
                                                EG(scope) = old_scope;
                                        } else {
-                                               long l;  
+                                               long l;
                                                double d;
+                                               int varname_len = 
strlen(ent1->varname);
                                
-                                               switch 
(is_numeric_string(ent1->varname, strlen(ent1->varname), &l, &d, 0)) {
+                                               switch 
(is_numeric_string(ent1->varname, varname_len, &l, &d, 0)) {
                                                        case IS_DOUBLE:
                                                                if (d > 
INT_MAX) {
                                                                        goto 
bigint;
@@ -988,7 +989,7 @@
                                                                break;
                                                        default:
 bigint:
-                                                               
zend_hash_update(target_hash,ent1->varname, strlen(ent1->varname)+1, 
&ent1->data, sizeof(zval *), NULL);
+                                                               
zend_hash_update(target_hash,ent1->varname, varname_len + 1, &ent1->data, 
sizeof(zval *), NULL);
                                                }
                                        }
                                        efree(ent1->varname);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to