]> granicus.if.org Git - php/commitdiff
Avoid double IS_INTERNED() check
authorDmitry Stogov <dmitry@zend.com>
Fri, 19 Sep 2014 13:32:50 +0000 (17:32 +0400)
committerDmitry Stogov <dmitry@zend.com>
Fri, 19 Sep 2014 13:32:50 +0000 (17:32 +0400)
24 files changed:
Zend/zend.c
Zend/zend_builtin_functions.c
Zend/zend_compile.c
Zend/zend_constants.c
Zend/zend_execute_API.c
Zend/zend_hash.c
Zend/zend_types.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/com_dotnet/com_wrapper.c
ext/reflection/php_reflection.c
ext/session/mod_user.c
ext/soap/php_sdl.c
ext/soap/soap.c
ext/spl/spl_functions.c
ext/spl/spl_iterators.c
ext/standard/array.c
ext/standard/assert.c
ext/standard/basic_functions.c
ext/standard/string.c
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re
ext/tokenizer/tokenizer.c
ext/xsl/xsltprocessor.c

index 78b18dbbc62872d6757b2fb9efb0ab6238b044f7..f7b6ceb70e6c813bc23686dd5b0a90e180847810 100644 (file)
@@ -278,7 +278,7 @@ again:
                case IS_REFERENCE:
                        expr = Z_REFVAL_P(expr);
                        if (Z_TYPE_P(expr) == IS_STRING) {
-                               ZVAL_STR(expr_copy, zend_string_copy(Z_STR_P(expr)));
+                               ZVAL_STR_COPY(expr_copy, Z_STR_P(expr));
                                return 1;
                        }
                        goto again;
index 1bb02ef2eb1963fdd1ea6e1f9b42436b2f4b658b..7885a455285b198c5e4ef1f3fd57cd80f55121f2 100644 (file)
@@ -660,7 +660,7 @@ ZEND_FUNCTION(each)
 
        /* add the key elements */
        if (zend_hash_get_current_key(target_hash, &key, &num_key, 0) == HASH_KEY_IS_STRING) {
-               ZVAL_STR(&tmp, zend_string_copy(key));
+               ZVAL_STR_COPY(&tmp, key);
                if (Z_REFCOUNTED(tmp)) Z_ADDREF(tmp);
        } else {
                ZVAL_LONG(&tmp, num_key);
@@ -1131,7 +1131,7 @@ ZEND_FUNCTION(get_class_methods)
 
                        /* Do not display old-style inherited constructors */
                        if (!key) {
-                               ZVAL_STR(&method_name, zend_string_copy(mptr->common.function_name));
+                               ZVAL_STR_COPY(&method_name, mptr->common.function_name);
                                zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
                        } else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
                            mptr->common.scope == ce ||
@@ -1141,10 +1141,10 @@ ZEND_FUNCTION(get_class_methods)
                                    *mptr->op_array.refcount > 1 &&
                                (len != key->len ||
                                 !same_name(key->val, mptr->common.function_name->val, len))) {
-                                       ZVAL_STR(&method_name, zend_string_copy(zend_find_alias_name(mptr->common.scope, key)));
+                                       ZVAL_STR_COPY(&method_name, zend_find_alias_name(mptr->common.scope, key));
                                        zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
                                } else {
-                                       ZVAL_STR(&method_name, zend_string_copy(mptr->common.function_name));
+                                       ZVAL_STR_COPY(&method_name, mptr->common.function_name);
                                        zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
                                }
                        }
index 8748dc0c98b91a76fa7628174b96c82cbba9368f..4205a942e01a3349520c3890864d2582c19dcf0e 100644 (file)
@@ -6528,7 +6528,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
                        ZVAL_LONG(zv, CG(zend_lineno));
                        break;
                case T_FILE:
-                       ZVAL_STR(zv, zend_string_copy(CG(compiled_filename)));
+                       ZVAL_STR_COPY(zv, CG(compiled_filename));
                        break;
                case T_DIR:
                {
@@ -6551,7 +6551,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
                }
                case T_FUNC_C:
                        if (op_array && op_array->function_name) {
-                               ZVAL_STR(zv, zend_string_copy(op_array->function_name));
+                               ZVAL_STR_COPY(zv, op_array->function_name);
                        } else {
                                ZVAL_EMPTY_STRING(zv);
                        }
@@ -6562,10 +6562,10 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
                                        ZVAL_NEW_STR(zv, zend_concat3(ce->name->val, ce->name->len, "::", 2,
                                                op_array->function_name->val, op_array->function_name->len));
                                } else {
-                                       ZVAL_STR(zv, zend_string_copy(ce->name));
+                                       ZVAL_STR_COPY(zv, ce->name);
                                }
                        } else if (op_array && op_array->function_name) {
-                               ZVAL_STR(zv, zend_string_copy(op_array->function_name));
+                               ZVAL_STR_COPY(zv, op_array->function_name);
                        } else {
                                ZVAL_EMPTY_STRING(zv);
                        }
@@ -6575,7 +6575,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
                                if (ZEND_CE_IS_TRAIT(ce)) {
                                        return 0;
                                } else {
-                                       ZVAL_STR(zv, zend_string_copy(ce->name));
+                                       ZVAL_STR_COPY(zv, ce->name);
                                }
                        } else {
                                ZVAL_EMPTY_STRING(zv);
@@ -6583,14 +6583,14 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
                        break;
                case T_TRAIT_C:
                        if (ce && ZEND_CE_IS_TRAIT(ce)) {
-                               ZVAL_STR(zv, zend_string_copy(ce->name));
+                               ZVAL_STR_COPY(zv, ce->name);
                        } else {
                                ZVAL_EMPTY_STRING(zv);
                        }
                        break;
                case T_NS_C:
                        if (CG(current_namespace)) {
-                               ZVAL_STR(zv, zend_string_copy(CG(current_namespace)));
+                               ZVAL_STR_COPY(zv, CG(current_namespace));
                        } else {
                                ZVAL_EMPTY_STRING(zv);
                        }
@@ -7265,7 +7265,7 @@ void zend_compile_resolve_class_name(znode *result, zend_ast *ast TSRMLS_DC) /*
                                        "Cannot access self::class when no class scope is active");
                        }
                        result->op_type = IS_CONST;
-                       ZVAL_STR(&result->u.constant, zend_string_copy(CG(active_class_entry)->name));
+                       ZVAL_STR_COPY(&result->u.constant, CG(active_class_entry)->name);
                        break;
         case ZEND_FETCH_CLASS_STATIC:
         case ZEND_FETCH_CLASS_PARENT:
@@ -7469,7 +7469,7 @@ void zend_compile_const_expr_resolve_class_name(zend_ast **ast_ptr TSRMLS_DC) /*
                                zend_error_noreturn(E_COMPILE_ERROR,
                                        "Cannot access self::class when no class scope is active");
                        }
-                       ZVAL_STR(&result, zend_string_copy(CG(active_class_entry)->name));
+                       ZVAL_STR_COPY(&result, CG(active_class_entry)->name);
                        break;
         case ZEND_FETCH_CLASS_STATIC:
         case ZEND_FETCH_CLASS_PARENT:
index bca35cf591a64c2d83365d00c7153456ec33b1c4..164901f898bc9c1289f03f44ef4e9b8d6b70bf8b 100644 (file)
@@ -246,7 +246,7 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len
                        if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
                                c = emalloc(sizeof(zend_constant));
                                memset(c, 0, sizeof(zend_constant));
-                               ZVAL_STR(&c->value, zend_string_copy(EG(scope)->name));
+                               ZVAL_STR_COPY(&c->value, EG(scope)->name);
                                zend_hash_add_ptr(EG(zend_constants), const_name, c);
                        }
                        zend_string_release(const_name);
index 5b3d59711274110665fd6c3135422867e887f53a..f59a10179b6aa5d08dc89fcfbe1461489739ea3d 100644 (file)
@@ -1011,12 +1011,12 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
        if (name->val[0] == '\\') {
                ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1);
        } else {
-               ZVAL_STR(&args[0], zend_string_copy(name));
+               ZVAL_STR_COPY(&args[0], name);
        }
 
        fcall_info.size = sizeof(fcall_info);
        fcall_info.function_table = EG(function_table);
-       ZVAL_STR(&fcall_info.function_name, zend_string_copy(EG(autoload_func)->common.function_name));
+       ZVAL_STR_COPY(&fcall_info.function_name, EG(autoload_func)->common.function_name);
        fcall_info.symbol_table = NULL;
        fcall_info.retval = &local_retval;
        fcall_info.param_count = 1;
index d541b3168fa7998a142bfd1de00669ceac56d722..6304737f04e8feee3cf7eccb987f1db1695671b2 100644 (file)
@@ -1599,8 +1599,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key,
        } else {
                p = ht->arData + idx;
                if (p->key) {
-                       ZVAL_STR(key, p->key);
-                       zend_string_addref(p->key);
+                       ZVAL_STR_COPY(key, p->key);
                } else {
                        ZVAL_LONG(key, p->h);
                }
index e23842c67961f9b10376ac1711a92805b6d948b8..c6541061921223171521ad61390ed83e16ee1943 100644 (file)
@@ -537,10 +537,22 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
                zval *__z = (z);                                                \
                zend_string *__s = (s);                                 \
                Z_STR_P(__z) = __s;                                             \
-               /* interned strings support */                  \
                Z_TYPE_INFO_P(__z) = IS_STRING_EX;              \
        } while (0)
 
+#define ZVAL_STR_COPY(z, s) do {                                               \
+               zval *__z = (z);                                                                \
+               zend_string *__s = (s);                                                 \
+               Z_STR_P(__z) = __s;                                                             \
+               /* interned strings support */                                  \
+               if (IS_INTERNED(__s)) {                                                 \
+                       Z_TYPE_INFO_P(__z) = IS_INTERNED_STRING_EX;     \
+               } else {                                                                                \
+                       GC_REFCOUNT(__s)++;                                                     \
+                       Z_TYPE_INFO_P(__z) = IS_STRING_EX;                      \
+               }                                                                                               \
+       } while (0)
+
 #define ZVAL_ARR(z, a) do {                                            \
                zval *__z = (z);                                                \
                Z_ARR_P(__z) = (a);                                             \
index ac015aea5260ff06210dc04d171bf0cacbc4aab7..b4f8c83f1bb5d0e21d3307518996b227f8fd9403 100644 (file)
@@ -3883,8 +3883,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
                        ZVAL_DUP(EX_VAR(opline->result.var), value);
                } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
                        /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
-                       ZVAL_STR(EX_VAR(opline->result.var), ce->name);
-                       zend_string_addref(ce->name);
+                       ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
                } else {
                        zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
                }
@@ -4716,11 +4715,8 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
                        if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
                                if (!p->key) {
                                        ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
-                               } else if (IS_INTERNED(p->key)) {
-                                       ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
                                } else {
-                                       ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
-                                       GC_REFCOUNT(p->key)++;
+                                       ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
                                }
                        }
                        break;
@@ -4796,12 +4792,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
                                } else if (zend_check_property_access(zobj, p->key TSRMLS_CC) == SUCCESS) {
                                        if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
                                                if (p->key->val[0]) {
-                                                       if (IS_INTERNED(p->key)) {
-                                                               ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
-                                                       } else {
-                                                               ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
-                                                               GC_REFCOUNT(p->key)++;
-                                                       }
+                                                       ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
                                                } else {
                                                        const char *class_name, *prop_name;
                                                        size_t prop_name_len;
index d2afba627251ae70dba9aff6507ec9c236d5ace2..d575db001821871dddb6c51295031d27116de62d 100644 (file)
@@ -4311,8 +4311,7 @@ static int ZEND_FASTCALL  ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
                        ZVAL_DUP(EX_VAR(opline->result.var), value);
                } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
                        /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
-                       ZVAL_STR(EX_VAR(opline->result.var), ce->name);
-                       zend_string_addref(ce->name);
+                       ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
                } else {
                        zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
                }
@@ -16676,11 +16675,8 @@ static int ZEND_FASTCALL  ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
                        if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
                                if (!p->key) {
                                        ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
-                               } else if (IS_INTERNED(p->key)) {
-                                       ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
                                } else {
-                                       ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
-                                       GC_REFCOUNT(p->key)++;
+                                       ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
                                }
                        }
                        break;
@@ -16756,12 +16752,7 @@ static int ZEND_FASTCALL  ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
                                } else if (zend_check_property_access(zobj, p->key TSRMLS_CC) == SUCCESS) {
                                        if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
                                                if (p->key->val[0]) {
-                                                       if (IS_INTERNED(p->key)) {
-                                                               ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
-                                                       } else {
-                                                               ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
-                                                               GC_REFCOUNT(p->key)++;
-                                                       }
+                                                       ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
                                                } else {
                                                        const char *class_name, *prop_name;
                                                        size_t prop_name_len;
@@ -18714,8 +18705,7 @@ static int ZEND_FASTCALL  ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
                        ZVAL_DUP(EX_VAR(opline->result.var), value);
                } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
                        /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
-                       ZVAL_STR(EX_VAR(opline->result.var), ce->name);
-                       zend_string_addref(ce->name);
+                       ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
                } else {
                        zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
                }
@@ -27977,8 +27967,7 @@ static int ZEND_FASTCALL  ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
                        ZVAL_DUP(EX_VAR(opline->result.var), value);
                } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
                        /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
-                       ZVAL_STR(EX_VAR(opline->result.var), ce->name);
-                       zend_string_addref(ce->name);
+                       ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
                } else {
                        zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
                }
index 409b8f9956bdabe5a09204afe92040a2182a9995..98252eeb246ef850eb74f4bf43cea392cd33627b 100644 (file)
@@ -482,7 +482,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
                        }
 
                        /* add the mappings */
-                       ZVAL_STR(&tmp2, zend_string_copy(name));
+                       ZVAL_STR_COPY(&tmp2, name);
                        pid = zend_hash_next_free_element(disp->dispid_to_name);
                        zend_hash_index_update(disp->dispid_to_name, pid, &tmp2);
                        
@@ -517,7 +517,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
                        }
 
                        /* add the mappings */
-                       ZVAL_STR(&tmp2, zend_string_copy(name));
+                       ZVAL_STR_COPY(&tmp2, name);
                        pid = zend_hash_next_free_element(disp->dispid_to_name);
                        zend_hash_index_update(disp->dispid_to_name, pid, &tmp2);
 
index c2e26103085d54e4df99a1e28a91507a4c906495..7e4f4ab7fbed22dca52de0ea7899e42f11946ffe 100644 (file)
@@ -1178,7 +1178,7 @@ PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSR
        reflection_object *intern;
        zval name;
 
-       ZVAL_STR(&name, zend_string_copy(ce->name));
+       ZVAL_STR_COPY(&name, ce->name);
        reflection_instantiate(reflection_class_ptr, object TSRMLS_CC);
        intern = Z_REFLECTION_P(object);
        intern->ptr = ce;
@@ -1251,7 +1251,7 @@ static void reflection_function_factory(zend_function *function, zval *closure_o
        reflection_object *intern;
        zval name;
 
-       ZVAL_STR(&name, zend_string_copy(function->common.function_name));
+       ZVAL_STR_COPY(&name, function->common.function_name);
 
        reflection_instantiate(reflection_function_ptr, object TSRMLS_CC);
        intern = Z_REFLECTION_P(object);
@@ -1273,9 +1273,9 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
        zval name;
        zval classname;
 
-       ZVAL_STR(&name, zend_string_copy((method->common.scope && method->common.scope->trait_aliases)?
-                       zend_resolve_method_name(ce, method) : method->common.function_name));
-       ZVAL_STR(&classname, zend_string_copy(method->common.scope->name));
+       ZVAL_STR_COPY(&name, (method->common.scope && method->common.scope->trait_aliases)?
+                       zend_resolve_method_name(ce, method) : method->common.function_name);
+       ZVAL_STR_COPY(&classname, method->common.scope->name);
        reflection_instantiate(reflection_method_ptr, object TSRMLS_CC);
        intern = Z_REFLECTION_P(object);
        intern->ptr = method;
@@ -1320,7 +1320,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
        }
 
        ZVAL_STRINGL(&name, prop_name, prop_name_len);
-       ZVAL_STR(&classname, zend_string_copy(prop->ce->name));
+       ZVAL_STR_COPY(&classname, prop->ce->name);
 
        reflection_instantiate(reflection_property_ptr, object TSRMLS_CC);
        intern = Z_REFLECTION_P(object);
@@ -1623,7 +1623,7 @@ ZEND_METHOD(reflection_function, __construct)
                return;
        }
 
-       ZVAL_STR(&name, zend_string_copy(fptr->common.function_name));
+       ZVAL_STR_COPY(&name, fptr->common.function_name);
        reflection_update_property(object, "name", &name);
        intern->ptr = fptr;
        intern->ref_type = REF_TYPE_FUNCTION;
@@ -2740,9 +2740,9 @@ ZEND_METHOD(reflection_method, __construct)
        }
        efree(lcname);
 
-       ZVAL_STR(&name, zend_string_copy(mptr->common.scope->name));
+       ZVAL_STR_COPY(&name, mptr->common.scope->name);
        reflection_update_property(object, "class", &name);
-       ZVAL_STR(&name, zend_string_copy(mptr->common.function_name));
+       ZVAL_STR_COPY(&name, mptr->common.function_name);
        reflection_update_property(object, "name", &name);
        intern->ptr = mptr;
        intern->ref_type = REF_TYPE_FUNCTION;
@@ -3305,7 +3305,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
        }
 
        if (Z_TYPE_P(argument) == IS_OBJECT) {
-               ZVAL_STR(&classname, zend_string_copy(Z_OBJCE_P(argument)->name));
+               ZVAL_STR_COPY(&classname, Z_OBJCE_P(argument)->name);
                reflection_update_property(object, "name", &classname);
                intern->ptr = Z_OBJCE_P(argument);
                if (is_object) {
@@ -3321,7 +3321,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
                        return;
                }
 
-               ZVAL_STR(&classname, zend_string_copy(ce->name));
+               ZVAL_STR_COPY(&classname, ce->name);
                reflection_update_property(object, "name", &classname);
 
                intern->ptr = ce;
@@ -3795,7 +3795,7 @@ ZEND_METHOD(reflection_class, hasProperty)
                RETURN_TRUE;
        } else {
                if (Z_TYPE(intern->obj) != IS_UNDEF && Z_OBJ_HANDLER(intern->obj, has_property)) {
-                       ZVAL_STR(&property, zend_string_copy(name));
+                       ZVAL_STR_COPY(&property, name);
                        if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL TSRMLS_CC)) {
                                zval_ptr_dtor(&property);
                                RETURN_TRUE;
@@ -4799,10 +4799,10 @@ ZEND_METHOD(reflection_property, __construct)
                const char *class_name, *prop_name;
                size_t prop_name_len;
                zend_unmangle_property_name_ex(property_info->name, &class_name, &prop_name, &prop_name_len);
-               ZVAL_STR(&cname, zend_string_copy(property_info->ce->name));
+               ZVAL_STR_COPY(&cname, property_info->ce->name);
                ZVAL_STRINGL(&propname, prop_name, prop_name_len);
        } else {
-               ZVAL_STR(&cname, zend_string_copy(ce->name));
+               ZVAL_STR_COPY(&cname, ce->name);
                ZVAL_STRINGL(&propname, name_str, name_len);
        }
        reflection_update_property(object, "class", &cname);
@@ -5284,7 +5284,7 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has
                if (ini_entry->value) {
                        zval zv;
 
-                       ZVAL_STR(&zv, zend_string_copy(ini_entry->value));
+                       ZVAL_STR_COPY(&zv, ini_entry->value);
                        zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &zv);
                } else {
                        zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &EG(uninitialized_zval));
index 5d69712543a86a24e40a604603f0260eb6b52a69..f42ae15cbff178f7598123389c986c8a90f1b449 100644 (file)
@@ -44,7 +44,7 @@ ps_module ps_mod_user = {
 
 #define SESS_ZVAL_STR(vl, a)                                           \
 {                                                                                                      \
-       ZVAL_STR(a, zend_string_copy(vl));                                              \
+       ZVAL_STR_COPY(a, vl);                                                   \
 }
 
 static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRMLS_DC)
index c7e52dfb8c29652b3c6b26662527a771bf8966af..d67bea1ab712e6c6480336972caaad3886aa19f0 100644 (file)
@@ -3288,9 +3288,8 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl TSRMLS_DC)
                }
 
                smart_str_0(&headers);
-               ZVAL_STR(&str_headers, zend_string_copy(headers.s));
+               ZVAL_NEW_STR(&str_headers, headers.s);
                php_stream_context_set_option(context, "http", "header", &str_headers);
-               smart_str_free(&headers);
                zval_ptr_dtor(&str_headers);
        }
 
index 554957d512dd715c74611f82f9b413eb481771bb..97a569de30ebaf70f30bdc89da0b2bec5ad85fa0 100644 (file)
@@ -1429,7 +1429,7 @@ PHP_METHOD(SoapServer, addFunction)
                                        return;
                                }
 
-                               ZVAL_STR(&function_copy, zend_string_copy(f->common.function_name));
+                               ZVAL_STR_COPY(&function_copy, f->common.function_name);
                                zend_hash_update(service->soap_functions.ft, key, &function_copy);
 
                                zend_string_release(key);
@@ -1452,7 +1452,7 @@ PHP_METHOD(SoapServer, addFunction)
                        zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
                }
 
-               ZVAL_STR(&function_copy, zend_string_copy(f->common.function_name));
+               ZVAL_STR_COPY(&function_copy, f->common.function_name);
                zend_hash_update(service->soap_functions.ft, key, &function_copy);
                zend_string_release(key);
        } else if (Z_TYPE_P(function_name) == IS_LONG) {
@@ -1713,7 +1713,7 @@ PHP_METHOD(SoapServer, handle)
                                if (zend_hash_str_exists(&Z_OBJCE(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len)) {
                                        zval c_ret, constructor;
 
-                                       ZVAL_STR(&constructor, zend_string_copy(service->soap_class.ce->name));
+                                       ZVAL_STR_COPY(&constructor, service->soap_class.ce->name);
                                        if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) {
                                                php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor");
                                        }
index 13440355ce20087fffdfdd3b1c3e6077902ded11..4c0d29aa46831c814c36e475dd1a456832696bc8 100644 (file)
@@ -84,8 +84,7 @@ void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_fla
 
                if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) {
                        zval t;
-                       zend_string_addref(pce->name);
-                       ZVAL_STR(&t, pce->name);
+                       ZVAL_STR_COPY(&t, pce->name);
                        zend_hash_add(Z_ARRVAL_P(list), pce->name, &t);
                }
        }
index dcc2a8a57356fbd608dff10eb56bcc5043e94105..39e5bd512fd06b764a949b1cc6ae1fd0e2645fd8 100644 (file)
@@ -2264,7 +2264,7 @@ SPL_METHOD(RecursiveRegexIterator, getChildren)
 
        zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
        if (!EG(exception)) {
-               ZVAL_STR(&regex, zend_string_copy(intern->u.regex.regex));
+               ZVAL_STR_COPY(&regex, intern->u.regex.regex);
                spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &retval, &regex TSRMLS_CC);
                zval_ptr_dtor(&regex);
        }
index ecb8603d2c849abdf45b07df669991da1e093b81..b6ca16ca7f524b4f49d4fcfef32da391675f5bbb 100644 (file)
@@ -706,12 +706,12 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
        if (f->key == NULL) {
                ZVAL_LONG(&args[0], f->h);
        } else {
-               ZVAL_STR(&args[0], zend_string_copy(f->key));
+               ZVAL_STR_COPY(&args[0], f->key);
        }
        if (s->key == NULL) {
                ZVAL_LONG(&args[1], s->h);
        } else {
-               ZVAL_STR(&args[1], zend_string_copy(s->key));
+               ZVAL_STR_COPY(&args[1], s->key);
        }
 
        BG(user_compare_fci).param_count = 2;
@@ -1427,7 +1427,7 @@ PHP_FUNCTION(extract)
                                if (var_exists && var_name->len == sizeof("this")-1  && !strcmp(var_name->val, "this") && EG(scope) && EG(scope)->name->len != 0) {
                                        break;
                                }
-                               ZVAL_STR(&final_name, zend_string_copy(var_name));
+                               ZVAL_STR_COPY(&final_name, var_name);
                                break;
 
                        case EXTR_PREFIX_IF_EXISTS:
@@ -1438,7 +1438,7 @@ PHP_FUNCTION(extract)
 
                        case EXTR_PREFIX_SAME:
                                if (!var_exists && var_name->len != 0) {
-                                       ZVAL_STR(&final_name, zend_string_copy(var_name));
+                                       ZVAL_STR_COPY(&final_name, var_name);
                                }
                                /* break omitted intentionally */
 
@@ -1453,14 +1453,14 @@ PHP_FUNCTION(extract)
                                        if (!php_valid_var_name(var_name->val, var_name->len)) {
                                                php_prefix_varname(&final_name, prefix, var_name->val, var_name->len, 1 TSRMLS_CC);
                                        } else {
-                                               ZVAL_STR(&final_name, zend_string_copy(var_name));
+                                               ZVAL_STR_COPY(&final_name, var_name);
                                        }
                                }
                                break;
 
                        default:
                                if (!var_exists) {
-                                       ZVAL_STR(&final_name, zend_string_copy(var_name));
+                                       ZVAL_STR_COPY(&final_name, var_name);
                                }
                                break;
                }
@@ -2605,7 +2605,7 @@ PHP_FUNCTION(array_keys)
 
                if (add_key) {
                        if (str_idx) {
-                               ZVAL_STR(&new_val, zend_string_copy(str_idx));
+                               ZVAL_STR_COPY(&new_val, str_idx);
                        } else {
                                ZVAL_LONG(&new_val, num_idx);
                        }
@@ -2889,14 +2889,14 @@ PHP_FUNCTION(array_flip)
        ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
                if (Z_TYPE_P(entry) == IS_LONG) {
                        if (str_idx) {
-                               ZVAL_STR(&data, zend_string_copy(str_idx));
+                               ZVAL_STR_COPY(&data, str_idx);
                        } else {
                                ZVAL_LONG(&data, num_idx);
                        }
                        zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data);
                } else if (Z_TYPE_P(entry) == IS_STRING) {
                        if (str_idx) {
-                               ZVAL_STR(&data, zend_string_copy(str_idx));
+                               ZVAL_STR_COPY(&data, str_idx);
                        } else {
                                ZVAL_LONG(&data, num_idx);
                        }
@@ -4366,9 +4366,9 @@ PHP_FUNCTION(array_filter)
                                        }
                                } else {
                                        if (use_type == ARRAY_FILTER_USE_BOTH) {
-                                               ZVAL_STR(&args[1], zend_string_copy(string_key));
+                                               ZVAL_STR_COPY(&args[1], string_key);
                                        } else if (use_type == ARRAY_FILTER_USE_KEY) {
-                                               ZVAL_STR(&args[0], zend_string_copy(string_key));
+                                               ZVAL_STR_COPY(&args[0], string_key);
                                        }
                                }
                        }
index 94fee5a1ce843fb04d0b5c96123757581248ecd5..15370225381564bb469311f8a264bc08647b5abd 100644 (file)
@@ -59,7 +59,7 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
                        ZVAL_UNDEF(&ASSERTG(callback));
                }
                if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value->len)) {
-                       ZVAL_STR(&ASSERTG(callback), zend_string_copy(new_value));
+                       ZVAL_STR_COPY(&ASSERTG(callback), new_value);
                }
        } else {
                if (ASSERTG(cb)) {
index 53aec268b046177f0455c99fe6bb4d198d5de8f5..f6ad7dbdd7b8dc46d3a215d5b33102294696378e 100644 (file)
@@ -5261,7 +5261,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
                        if (ini_entry->value) {
                                zval zv;
 
-                               ZVAL_STR(&zv, zend_string_copy(ini_entry->value));
+                               ZVAL_STR_COPY(&zv, ini_entry->value);
                                zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &zv);
                        } else {
                                zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &EG(uninitialized_zval));
index fec8b70934cbeca11df29d4b4476c166bf2f9bb6..a5041afee3e7acbbe7c0a687de684e4d8a046a26 100644 (file)
@@ -2559,7 +2559,7 @@ PHP_FUNCTION(substr_replace)
                        if (str_index) {
                                zval tmp;
 
-                               ZVAL_STR(&tmp, result);
+                               ZVAL_NEW_STR(&tmp, result);
                                zend_symtable_update(Z_ARRVAL_P(return_value), str_index, &tmp);
                        } else {
                                add_index_str(return_value, num_index, result);
index 7e6789daaa6164e80669347588fc5e22eaea06e9..20d62602281fe01a34e3ebac918fb13fd9de98ae 100644 (file)
@@ -700,7 +700,7 @@ yy20:
                /* Call unserialize callback */
                ZVAL_STRING(&user_func, PG(unserialize_callback_func));
                
-               ZVAL_STR(&args[0], zend_string_copy(class_name));
+               ZVAL_STR_COPY(&args[0], class_name);
                BG(serialize_lock)++;
                if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
                        BG(serialize_lock)--;
index 39161353f8acb16ed40e27e6b8f41016f62eac06..7924022263d1c7af20b57abd6da5cde13cb52de4 100644 (file)
@@ -755,7 +755,7 @@ object ":" uiv ":" ["]      {
                /* Call unserialize callback */
                ZVAL_STRING(&user_func, PG(unserialize_callback_func));
                
-               ZVAL_STR(&args[0], zend_string_copy(class_name));
+               ZVAL_STR_COPY(&args[0], class_name);
                BG(serialize_lock)++;
                if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
                        BG(serialize_lock)--;
index 1847b0537d2246474584b4d0750b6dbcab9ebf1c..80ab5a81d86892c9c04aa6ce2bdcc3bd7417963b 100644 (file)
@@ -185,7 +185,7 @@ PHP_FUNCTION(token_get_all)
                return;
        }
 
-       ZVAL_STR(&source_zval, zend_string_copy(source));
+       ZVAL_STR_COPY(&source_zval, source);
        zend_save_lexical_state(&original_lex_state TSRMLS_CC);
 
        if (zend_prepare_string_for_scanning(&source_zval, "" TSRMLS_CC) == FAILURE) {
index cd828c75a0d02b68e69c6b3f4bd0ded03a3e5347..6c53f39a6d12b8f7e34b21c0d5ba4bb84aa4bdf9 100644 (file)
@@ -791,7 +791,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
                
                intern = Z_XSL_P(id);
                
-               ZVAL_STR(&new_string, zend_string_copy(value));
+               ZVAL_STR_COPY(&new_string, value);
                
                zend_hash_update(intern->parameter, name, &new_string);
                RETURN_TRUE;