Skip to content

Commit a6fc427

Browse files
committedMar 17, 2021
Use zend_string_equals() API instead of strcmp() in various places
Closes phpGH-6784
1 parent a74e248 commit a6fc427

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed
 

‎Zend/zend_compile.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7902,7 +7902,7 @@ static bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast) /* {{{ */
79027902
ZSTR_LEN(dirname) = zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname));
79037903
#endif
79047904

7905-
if (strcmp(ZSTR_VAL(dirname), ".") == 0) {
7905+
if (zend_string_equals_literal(dirname, ".")) {
79067906
dirname = zend_string_extend(dirname, MAXPATHLEN, 0);
79077907
#if HAVE_GETCWD
79087908
ZEND_IGNORE_VALUE(VCWD_GETCWD(ZSTR_VAL(dirname), MAXPATHLEN));

‎ext/gd/gd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3182,7 +3182,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode)
31823182
if (key == NULL) {
31833183
continue;
31843184
}
3185-
if (strcmp("linespacing", ZSTR_VAL(key)) == 0) {
3185+
if (zend_string_equals_literal(key, "linespacing")) {
31863186
strex.flags |= gdFTEX_LINESPACE;
31873187
strex.linespacing = zval_get_double(item);
31883188
}

‎ext/standard/string.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4634,7 +4634,7 @@ PHP_FUNCTION(strip_tags)
46344634
static zend_string *try_setlocale_str(zend_long cat, zend_string *loc) {
46354635
const char *retval;
46364636

4637-
if (!strcmp("0", ZSTR_VAL(loc))) {
4637+
if (zend_string_equals_literal(loc, "0")) {
46384638
loc = NULL;
46394639
} else {
46404640
if (ZSTR_LEN(loc) >= 255) {

‎ext/xml/xml.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
813813

814814
ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL(parser->data), curtag) {
815815
if ((mytype = zend_hash_str_find(Z_ARRVAL_P(curtag),"type", sizeof("type") - 1))) {
816-
if (!strcmp(Z_STRVAL_P(mytype), "cdata")) {
816+
if (zend_string_equals_literal(Z_STR_P(mytype), "cdata")) {
817817
if ((myval = zend_hash_str_find(Z_ARRVAL_P(curtag), "value", sizeof("value") - 1))) {
818818
int newlen = Z_STRLEN_P(myval) + ZSTR_LEN(decoded_value);
819819
Z_STR_P(myval) = zend_string_extend(Z_STR_P(myval), newlen, 0);

0 commit comments

Comments
 (0)