Skip to content

Commit d96eab8

Browse files
committed
Use the new 'ZSTR' macros in the rest of the code.
Does not change anything to the generated code (thanks to compat macros) but cleaner.
1 parent b352643 commit d96eab8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+194
-195
lines changed

Zend/zend_API.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */
16531653
result = zend_symtable_update(ht, Z_STR_P(key), value);
16541654
break;
16551655
case IS_NULL:
1656-
result = zend_symtable_update(ht, STR_EMPTY_ALLOC(), value);
1656+
result = zend_symtable_update(ht, ZSTR_EMPTY_ALLOC(), value);
16571657
break;
16581658
case IS_RESOURCE:
16591659
zend_error(E_NOTICE, "Resource ID#" ZEND_LONG_FMT " used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
@@ -2842,7 +2842,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
28422842
zend_string *lcname;
28432843
ALLOCA_FLAG(use_heap);
28442844

2845-
STR_ALLOCA_ALLOC(lcname, name_len, use_heap);
2845+
ZSTR_ALLOCA_ALLOC(lcname, name_len, use_heap);
28462846
zend_str_tolower_copy(lcname->val, name->val, name_len);
28472847

28482848
*strict_class = 0;
@@ -2913,7 +2913,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
29132913
} else {
29142914
if (error) zend_spprintf(error, 0, "class '%.*s' not found", name_len, name->val);
29152915
}
2916-
STR_ALLOCA_FREE(lcname, use_heap);
2916+
ZSTR_ALLOCA_FREE(lcname, use_heap);
29172917
return ret;
29182918
}
29192919
/* }}} */
@@ -2943,31 +2943,31 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
29432943

29442944
/* Skip leading \ */
29452945
if (UNEXPECTED(Z_STRVAL_P(callable)[0] == '\\')) {
2946-
STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable) + 1, Z_STRLEN_P(callable) - 1, use_heap);
2946+
ZSTR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable) + 1, Z_STRLEN_P(callable) - 1, use_heap);
29472947
} else {
29482948
lmname = Z_STR_P(callable);
29492949
}
29502950
/* Check if function with given name exists.
29512951
* This may be a compound name that includes namespace name */
29522952
if (EXPECTED((fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname)) != NULL)) {
29532953
if (lmname != Z_STR_P(callable)) {
2954-
STR_ALLOCA_FREE(lmname, use_heap);
2954+
ZSTR_ALLOCA_FREE(lmname, use_heap);
29552955
}
29562956
return 1;
29572957
} else {
29582958
if (lmname == Z_STR_P(callable)) {
2959-
STR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable), Z_STRLEN_P(callable), use_heap);
2959+
ZSTR_ALLOCA_INIT(lmname, Z_STRVAL_P(callable), Z_STRLEN_P(callable), use_heap);
29602960
} else {
29612961
zend_string_forget_hash_val(lmname);
29622962
}
29632963
zend_str_tolower(lmname->val, lmname->len);
29642964
if ((fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname)) != NULL) {
2965-
STR_ALLOCA_FREE(lmname, use_heap);
2965+
ZSTR_ALLOCA_FREE(lmname, use_heap);
29662966
return 1;
29672967
}
29682968
}
29692969
if (lmname != Z_STR_P(callable)) {
2970-
STR_ALLOCA_FREE(lmname, use_heap);
2970+
ZSTR_ALLOCA_FREE(lmname, use_heap);
29712971
}
29722972
}
29732973

Zend/zend_ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
188188
zval_dtor(offset);
189189
break;
190190
case IS_NULL:
191-
zend_symtable_update(Z_ARRVAL_P(result), STR_EMPTY_ALLOC(), expr);
191+
zend_symtable_update(Z_ARRVAL_P(result), ZSTR_EMPTY_ALLOC(), expr);
192192
break;
193193
case IS_LONG:
194194
zend_hash_index_update(Z_ARRVAL_P(result), Z_LVAL_P(offset), expr);

Zend/zend_compile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int li
413413
if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) {
414414
zend_string_hash_val(Z_STR_P(zv));
415415
Z_STR_P(zv) = zend_new_interned_string(Z_STR_P(zv));
416-
if (IS_INTERNED(Z_STR_P(zv))) {
416+
if (ZSTR_IS_INTERNED(Z_STR_P(zv))) {
417417
Z_TYPE_FLAGS_P(zv) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
418418
}
419419
}
@@ -725,10 +725,10 @@ void *zend_hash_find_ptr_lc(HashTable *ht, const char *str, size_t len) {
725725
zend_string *lcname;
726726
ALLOCA_FLAG(use_heap);
727727

728-
STR_ALLOCA_ALLOC(lcname, len, use_heap);
728+
ZSTR_ALLOCA_ALLOC(lcname, len, use_heap);
729729
zend_str_tolower_copy(lcname->val, str, len);
730730
result = zend_hash_find_ptr(ht, lcname);
731-
STR_ALLOCA_FREE(lcname, use_heap);
731+
ZSTR_ALLOCA_FREE(lcname, use_heap);
732732

733733
return result;
734734
}
@@ -5708,7 +5708,7 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
57085708
zend_hash_index_update(Z_ARRVAL_P(result), 1, value);
57095709
break;
57105710
case IS_NULL:
5711-
zend_hash_update(Z_ARRVAL_P(result), STR_EMPTY_ALLOC(), value);
5711+
zend_hash_update(Z_ARRVAL_P(result), ZSTR_EMPTY_ALLOC(), value);
57125712
break;
57135713
default:
57145714
zend_error_noreturn(E_COMPILE_ERROR, "Illegal offset type");

Zend/zend_exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ ZEND_METHOD(exception, __toString)
673673

674674
DEFAULT_0_PARAMS;
675675

676-
str = STR_EMPTY_ALLOC();
676+
str = ZSTR_EMPTY_ALLOC();
677677

678678
exception = getThis();
679679
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1);

Zend/zend_execute.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,9 @@ ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info
573573
zend_string *key;
574574
ALLOCA_FLAG(use_heap);
575575

576-
STR_ALLOCA_INIT(key, cur_arg_info->class_name, strlen(cur_arg_info->class_name), use_heap);
576+
ZSTR_ALLOCA_INIT(key, cur_arg_info->class_name, strlen(cur_arg_info->class_name), use_heap);
577577
*pce = zend_fetch_class(key, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
578-
STR_ALLOCA_FREE(key, use_heap);
578+
ZSTR_ALLOCA_FREE(key, use_heap);
579579

580580
*class_name = (*pce) ? (*pce)->name->val : (char*)cur_arg_info->class_name;
581581
if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) {
@@ -1564,7 +1564,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
15641564
} else {
15651565
switch (Z_TYPE_P(dim)) {
15661566
case IS_NULL:
1567-
offset_key = STR_EMPTY_ALLOC();
1567+
offset_key = ZSTR_EMPTY_ALLOC();
15681568
goto str_index;
15691569
case IS_DOUBLE:
15701570
hval = zend_dval_to_lval(Z_DVAL_P(dim));

Zend/zend_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
524524
zend_hash_iterators_update(ht, HT_INVALID_IDX, idx);
525525
p = ht->arData + idx;
526526
p->key = key;
527-
if (!IS_INTERNED(key)) {
527+
if (!ZSTR_IS_INTERNED(key)) {
528528
zend_string_addref(key);
529529
ht->u.flags &= ~HASH_FLAG_STATIC_KEYS;
530530
zend_string_hash_val(key);

Zend/zend_hash.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ static zend_always_inline zval *_zend_hash_append(HashTable *ht, zend_string *ke
894894
Bucket *p = ht->arData + idx;
895895

896896
ZVAL_COPY_VALUE(&p->val, zv);
897-
if (!IS_INTERNED(key)) {
897+
if (!ZSTR_IS_INTERNED(key)) {
898898
ht->u.flags &= ~HASH_FLAG_STATIC_KEYS;
899899
zend_string_addref(key);
900900
zend_string_hash_val(key);
@@ -916,7 +916,7 @@ static zend_always_inline zval *_zend_hash_append_ptr(HashTable *ht, zend_string
916916
Bucket *p = ht->arData + idx;
917917

918918
ZVAL_PTR(&p->val, ptr);
919-
if (!IS_INTERNED(key)) {
919+
if (!ZSTR_IS_INTERNED(key)) {
920920
ht->u.flags &= ~HASH_FLAG_STATIC_KEYS;
921921
zend_string_addref(key);
922922
zend_string_hash_val(key);
@@ -938,7 +938,7 @@ static zend_always_inline void _zend_hash_append_ind(HashTable *ht, zend_string
938938
Bucket *p = ht->arData + idx;
939939

940940
ZVAL_INDIRECT(&p->val, ptr);
941-
if (!IS_INTERNED(key)) {
941+
if (!ZSTR_IS_INTERNED(key)) {
942942
ht->u.flags &= ~HASH_FLAG_STATIC_KEYS;
943943
zend_string_addref(key);
944944
zend_string_hash_val(key);

Zend/zend_language_parser.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ exit_expr:
10141014

10151015
backticks_expr:
10161016
/* empty */
1017-
{ $$ = zend_ast_create_zval_from_str(STR_EMPTY_ALLOC()); }
1017+
{ $$ = zend_ast_create_zval_from_str(ZSTR_EMPTY_ALLOC()); }
10181018
| T_ENCAPSED_AND_WHITESPACE { $$ = $1; }
10191019
| encaps_list { $$ = $1; }
10201020
;
@@ -1045,7 +1045,7 @@ scalar:
10451045
| T_CLASS_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_CLASS_C); }
10461046
| T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
10471047
| T_START_HEREDOC T_END_HEREDOC
1048-
{ $$ = zend_ast_create_zval_from_str(STR_EMPTY_ALLOC()); }
1048+
{ $$ = zend_ast_create_zval_from_str(ZSTR_EMPTY_ALLOC()); }
10491049
| '"' encaps_list '"' { $$ = $2; }
10501050
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
10511051
| dereferencable_scalar { $$ = $1; }

Zend/zend_object_handlers.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend
10481048

10491049
func->prototype = fbc;
10501050
func->scope = fbc->common.scope;
1051-
func->filename = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.filename : STR_EMPTY_ALLOC();
1051+
func->filename = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.filename : ZSTR_EMPTY_ALLOC();
10521052
func->line_start = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.line_start : 0;
10531053
func->line_end = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.line_end : 0;
10541054

@@ -1084,13 +1084,13 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
10841084
use_heap = 0;
10851085
#endif
10861086
} else {
1087-
STR_ALLOCA_ALLOC(lc_method_name, method_name->len, use_heap);
1087+
ZSTR_ALLOCA_ALLOC(lc_method_name, method_name->len, use_heap);
10881088
zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
10891089
}
10901090

10911091
if (UNEXPECTED((func = zend_hash_find(&zobj->ce->function_table, lc_method_name)) == NULL)) {
10921092
if (UNEXPECTED(!key)) {
1093-
STR_ALLOCA_FREE(lc_method_name, use_heap);
1093+
ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
10941094
}
10951095
if (zobj->ce->__call) {
10961096
return zend_get_user_call_function(zobj->ce, method_name);
@@ -1149,7 +1149,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
11491149
}
11501150

11511151
if (UNEXPECTED(!key)) {
1152-
STR_ALLOCA_FREE(lc_method_name, use_heap);
1152+
ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
11531153
}
11541154
return fbc;
11551155
}

Zend/zend_operators.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ ZEND_API zend_string* ZEND_FASTCALL _zval_get_string_func(zval *op) /* {{{ */
803803
case IS_UNDEF:
804804
case IS_NULL:
805805
case IS_FALSE:
806-
return STR_EMPTY_ALLOC();
806+
return ZSTR_EMPTY_ALLOC();
807807
case IS_TRUE:
808808
return zend_string_init("1", 1, 0);
809809
case IS_RESOURCE: {
@@ -838,7 +838,7 @@ ZEND_API zend_string* ZEND_FASTCALL _zval_get_string_func(zval *op) /* {{{ */
838838
zval_ptr_dtor(z);
839839
}
840840
zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(op)->name->val);
841-
return STR_EMPTY_ALLOC();
841+
return ZSTR_EMPTY_ALLOC();
842842
}
843843
case IS_REFERENCE:
844844
op = Z_REFVAL_P(op);

0 commit comments

Comments
 (0)