mirror of
https://github.com/php/php-src.git
synced 2025-08-21 01:45:16 +02:00
Added macros for managing zval refcounts and is_ref statuses
This commit is contained in:
parent
d20f6ecac8
commit
95da0dc570
86 changed files with 983 additions and 918 deletions
|
@ -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 */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue