]> granicus.if.org Git - php/commitdiff
optimization
authorDmitry Stogov <dmitry@php.net>
Wed, 18 Mar 2009 11:25:37 +0000 (11:25 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 18 Mar 2009 11:25:37 +0000 (11:25 +0000)
Zend/zend_operators.c

index ce1afff8d0bfa2346ce4d0eadce0fcbf08fa96f4..e8b579f8e2d90bdbf5d3420c4df77d1f06564d0c 100644 (file)
@@ -1736,10 +1736,10 @@ ZEND_API int increment_function(zval *op1)
                case IS_STRING: {
                                long lval;
                                double dval;
-                               char *strval = Z_STRVAL_P(op1);
 
-                               switch (is_numeric_string(strval, Z_STRLEN_P(op1), &lval, &dval, 0)) {
+                               switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) {
                                        case IS_LONG:
+                                               efree(Z_STRVAL_P(op1));
                                                if (lval == LONG_MAX) {
                                                        /* switch to double */
                                                        double d = (double)lval;
@@ -1747,11 +1747,10 @@ ZEND_API int increment_function(zval *op1)
                                                } else {
                                                        ZVAL_LONG(op1, lval+1);
                                                }
-                                               efree(strval); /* should never be empty_string */
                                                break;
                                        case IS_DOUBLE:
+                                               efree(Z_STRVAL_P(op1));
                                                ZVAL_DOUBLE(op1, dval+1);
-                                               efree(strval); /* should never be empty_string */
                                                break;
                                        default:
                                                /* Perl style string increment */