Use zend_string_equals() API instead of strcmp() in various places

Closes GH-6784
This commit is contained in:
George Peter Banyard 2021-03-17 11:50:54 +00:00
parent a74e248c43
commit a6fc427b8c
4 changed files with 4 additions and 4 deletions

View file

@ -7902,7 +7902,7 @@ static bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast) /* {{{ */
ZSTR_LEN(dirname) = zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname));
#endif
if (strcmp(ZSTR_VAL(dirname), ".") == 0) {
if (zend_string_equals_literal(dirname, ".")) {
dirname = zend_string_extend(dirname, MAXPATHLEN, 0);
#if HAVE_GETCWD
ZEND_IGNORE_VALUE(VCWD_GETCWD(ZSTR_VAL(dirname), MAXPATHLEN));

View file

@ -3182,7 +3182,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (key == NULL) {
continue;
}
if (strcmp("linespacing", ZSTR_VAL(key)) == 0) {
if (zend_string_equals_literal(key, "linespacing")) {
strex.flags |= gdFTEX_LINESPACE;
strex.linespacing = zval_get_double(item);
}

View file

@ -4634,7 +4634,7 @@ PHP_FUNCTION(strip_tags)
static zend_string *try_setlocale_str(zend_long cat, zend_string *loc) {
const char *retval;
if (!strcmp("0", ZSTR_VAL(loc))) {
if (zend_string_equals_literal(loc, "0")) {
loc = NULL;
} else {
if (ZSTR_LEN(loc) >= 255) {

View file

@ -813,7 +813,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
ZEND_HASH_REVERSE_FOREACH_VAL(Z_ARRVAL(parser->data), curtag) {
if ((mytype = zend_hash_str_find(Z_ARRVAL_P(curtag),"type", sizeof("type") - 1))) {
if (!strcmp(Z_STRVAL_P(mytype), "cdata")) {
if (zend_string_equals_literal(Z_STR_P(mytype), "cdata")) {
if ((myval = zend_hash_str_find(Z_ARRVAL_P(curtag), "value", sizeof("value") - 1))) {
int newlen = Z_STRLEN_P(myval) + ZSTR_LEN(decoded_value);
Z_STR_P(myval) = zend_string_extend(Z_STR_P(myval), newlen, 0);