8000 Use zend_string_equals_literal_ci instread of macros · ebogdanov/phpredis@9f2972b · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f2972b

Browse files
committed
Use zend_string_equals_literal_ci instread of macros
1 parent 43a39af commit 9f2972b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

redis_commands.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,6 @@ int redis_fmt_scan_cmd(char **cmd, REDIS_SCAN_TYPE type, char *key, int key_len,
509509
return cmdstr.len;
510510
}
511511

512-
/* ZRANGEBYSCORE/ZREVRANGEBYSCORE */
513-
#define IS_WITHSCORES_ARG(s, l) \
514-
(l == sizeof("withscores") - 1 && !strncasecmp(s, "withscores", l))
515-
#define IS_LIMIT_ARG(s, l) \
516-
(l == sizeof("limit") - 1 && !strncasecmp(s,"limit", l))
517-
518512
/* ZRANGE/ZREVRANGE */
519513
int redis_zrange_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
520514
char *kw, char **cmd, int *cmd_len, int *withscores,
@@ -540,7 +534,7 @@ int redis_zrange_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
540534
if (Z_TYPE_P(z_ws) == IS_ARRAY) {
541535
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(z_ws), zkey, z_ele) {
542536
ZVAL_DEREF(z_ele);
543-
if (IS_WITHSCORES_ARG(ZSTR_VAL(zkey), ZSTR_LEN(zkey))) {
537+
if (zend_string_equals_literal_ci(zkey, "withscores")) {
544538
*withscores = zval_is_true(z_ele);
545539
break;
546540
}
@@ -590,9 +584,9 @@ int redis_zrangebyscore_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
590584
if< 73DF /span> (!zkey) continue;
591585
ZVAL_DEREF(z_ele);
592586
/* Check for withscores and limit */
593-
if (IS_WITHSCORES_ARG(ZSTR_VAL(zkey), ZSTR_LEN(zkey))) {
587+
if (zend_string_equals_literal_ci(zkey, "withscores")) {
594588
*withscores = zval_is_true(z_ele);
595-
} else if (IS_LIMIT_ARG(ZSTR_VAL(zkey), ZSTR_LEN(zkey)) && Z_TYPE_P(z_ele) == IS_ARRAY) {
589+
} else if (zend_string_equals_literal_ci(zkey, "limit") && Z_TYPE_P(z_ele) == IS_ARRAY) {
596590
HashTable *htlimit = Z_ARRVAL_P(z_ele);
597591
zval *zoff, *zcnt;
598592

0 commit comments

Comments
 (0)
0