Skip to content

Commit a51f564

Browse files
committed
Use known "count" zend_string instead of C string
1 parent a02f7f2 commit a51f564

File tree

7 files changed

+13
-7
lines changed

7 files changed

+13
-7
lines changed

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4522,7 +4522,7 @@ static zend_result zend_try_compile_special_func(znode *result, zend_string *lcn
45224522
return zend_compile_func_cuf(result, args, lcname);
45234523
} else if (zend_string_equals_literal(lcname, "in_array")) {
45244524
return zend_compile_func_in_array(result, args);
4525-
} else if (zend_string_equals_literal(lcname, "count")
4525+
} else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_COUNT))
45264526
|| zend_string_equals_literal(lcname, "sizeof")) {
45274527
return zend_compile_func_count(result, args, lcname);
45284528
} else if (zend_string_equals_literal(lcname, "get_class")) {

ext/ldap/ldap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,8 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
634634
} else if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "offset", sizeof("offset") - 1)) != NULL) {
635635
vlvInfo.ldvlv_attrvalue = NULL;
636636
vlvInfo.ldvlv_offset = zval_get_long(tmp);
637-
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "count", sizeof("count") - 1)) != NULL) {
637+
/* Find "count" key */
638+
if ((tmp = zend_hash_find(Z_ARRVAL_P(val), ZSTR_KNOWN(ZEND_STR_COUNT))) != NULL) {
638639
vlvInfo.ldvlv_count = zval_get_long(tmp);
639640
} else {
640641
rc = -1;

ext/simplexml/simplexml.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,8 @@ static zend_function* php_sxe_find_fptr_count(zend_class_entry *ce)
21912191
}
21922192

21932193
if (inherited) {
2194-
fptr_count = zend_hash_str_find_ptr(&ce->function_table, "count", sizeof("count") - 1);
2194+
/* Find count() method */
2195+
fptr_count = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
21952196
if (fptr_count->common.scope == parent) {
21962197
fptr_count = NULL;
21972198
}

ext/spl/spl_array.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zend_o
211211
if (intern->fptr_offset_del->common.scope == parent) {
212212
intern->fptr_offset_del = NULL;
213213
}
214-
intern->fptr_count = zend_hash_str_find_ptr(&class_type->function_table, "count", sizeof("count") - 1);
214+
/* Find count() method */
215+
intern->fptr_count = zend_hash_find_ptr(&class_type->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
215216
if (intern->fptr_count->common.scope == parent) {
216217
intern->fptr_count = NULL;
217218
}

ext/spl/spl_dllist.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_
375375
if (intern->fptr_offset_del->common.scope == parent) {
376376
intern->fptr_offset_del = NULL;
377377
}
378-
intern->fptr_count = zend_hash_str_find_ptr(&class_type->function_table, "count", sizeof("count") - 1);
378+
/* Find count() method */
379+
intern->fptr_count = zend_hash_find_ptr(&class_type->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
379380
if (intern->fptr_count->common.scope == parent) {
380381
intern->fptr_count = NULL;
381382
}

ext/spl/spl_fixedarray.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z
282282
ZEND_ASSERT(parent);
283283

284284
if (UNEXPECTED(inherited)) {
285-
zend_function *fptr_count = zend_hash_str_find_ptr(&class_type->function_table, "count", sizeof("count") - 1);
285+
/* Find count() method */
286+
zend_function *fptr_count = zend_hash_find_ptr(&class_type->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
286287
if (fptr_count->common.scope == parent) {
287288
fptr_count = NULL;
288289
}

ext/spl/spl_heap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_ob
451451
if (intern->fptr_cmp->common.scope == parent) {
452452
intern->fptr_cmp = NULL;
453453
}
454-
intern->fptr_count = zend_hash_str_find_ptr(&class_type->function_table, "count", sizeof("count") - 1);
454+
/* Find count() method */
455+
intern->fptr_count = zend_hash_find_ptr(&class_type->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
455456
if (intern->fptr_count->common.scope == parent) {
456457
intern->fptr_count = NULL;
457458
}

0 commit comments

Comments
 (0)