diff options
author | Yiduo (David) Wang <davidw@php.net> | 2007-10-07 05:15:07 +0000 |
---|---|---|
committer | Yiduo (David) Wang <davidw@php.net> | 2007-10-07 05:15:07 +0000 |
commit | 95da0dc5700ee9d41f1e5664c8167cd37023dbd3 (patch) | |
tree | e4c6288af1a3f260bbd705c83c397741233d60ea /main/php_variables.c | |
parent | d20f6ecac8e2db5b0595c4fdef4cae221594ab88 (diff) | |
download | php-git-95da0dc5700ee9d41f1e5664c8167cd37023dbd3.tar.gz |
Added macros for managing zval refcounts and is_ref statuses
Diffstat (limited to 'main/php_variables.c')
-rw-r--r-- | main/php_variables.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/main/php_variables.c b/main/php_variables.c index 7fbe3d4779..91d1381f11 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -734,14 +734,14 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) Z_TYPE_P(argc) = IS_LONG; if (SG(request_info).argc) { - arr->refcount++; - argc->refcount++; + Z_ADDREF_P(arr); + Z_ADDREF_P(argc); zend_ascii_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL); zend_ascii_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL); } if (track_vars_array) { - arr->refcount++; - argc->refcount++; + Z_ADDREF_P(arr); + Z_ADDREF_P(argc); zend_ascii_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL); zend_ascii_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL); } @@ -824,7 +824,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) || (key_type == HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS) || Z_TYPE_PP(dest_entry) != IS_ARRAY ) { - (*src_entry)->refcount++; + Z_ADDREF_PP(src_entry); if (key_type == HASH_KEY_IS_STRING || key_type == HASH_KEY_IS_UNICODE) { zend_u_hash_update(dest, key_type, string_key, string_key_len, src_entry, sizeof(zval *), NULL); } else { @@ -927,7 +927,7 @@ int php_hash_environment(TSRMLS_D) INIT_PZVAL(PG(http_globals)[i]); } - PG(http_globals)[i]->refcount++; + Z_ADDREF_P(PG(http_globals)[i]); zend_ascii_hash_update(&EG(symbol_table), auto_global_records[i].name, auto_global_records[i].name_len, &PG(http_globals)[i], sizeof(zval *), NULL); } @@ -952,8 +952,8 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS if (zend_ascii_hash_find(&EG(symbol_table), "argc", sizeof("argc"), (void**)&argc) == SUCCESS && zend_ascii_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void**)&argv) == SUCCESS) { - (*argc)->refcount++; - (*argv)->refcount++; + Z_ADDREF_PP(argc); + Z_ADDREF_PP(argv); zend_ascii_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), argv, sizeof(zval *), NULL); zend_ascii_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "argc", sizeof("argc"), argc, sizeof(zval *), NULL); } @@ -974,7 +974,7 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS } zend_ascii_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL); - PG(http_globals)[TRACK_VARS_SERVER]->refcount++; + Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]); return 0; /* don't rearm */ } @@ -995,7 +995,7 @@ static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC } zend_ascii_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL); - PG(http_globals)[TRACK_VARS_ENV]->refcount++; + Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]); return 0; /* don't rearm */ } |