Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d66c893

Browse files
Updated redis_cmd_format_static to specifically take a long, and changed PEXIPREAT to use a long rather than an int
1 parent 3b87da6 commit d66c893

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

library.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,16 @@ redis_cmd_format_static(char **ret, char *keyword, char *format, ...) {
278278
smart_str_appendl(&buf, tmp, tmp_len);
279279
}
280280
break;
281+
case 'l':
282+
case 'L': {
283+
long l = va_arg(ap, long);
284+
char tmp[32];
285+
int tmp_len = snprintf(tmp, sizeof(tmp), "%ld", l);
286+
smart_str_append_long(&buf, tmp_len);
287+
smart_str_appendl(&buf, _NL, sizeof(_NL) -1);
288+
smart_str_appendl(&buf, tmp, tmp_len);
289+
}
290+
break;
281291
}
282292
p++;
283293
smart_str_appendl(&buf, _NL, sizeof(_NL) - 1);

redis.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ static zend_function_entry redis_functions[] = {
177177
PHP_ME(Redis, zUnion, NULL, ZEND_ACC_PUBLIC)
178178
PHP_ME(Redis, zIncrBy, NULL, ZEND_ACC_PUBLIC)
179179
PHP_ME(Redis, expireAt, NULL, ZEND_ACC_PUBLIC)
180+
PHP_ME(Redis, pexpire, NULL, ZEND_ACC_PUBLIC)
180181
PHP_ME(Redis, pexpireAt, NULL, ZEND_ACC_PUBLIC)
181182

182183
/* 1.2 */
@@ -2892,7 +2893,7 @@ PHPAPI void generic_expire_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword, int
28922893
}
28932894

28942895
key_free = redis_key_prefix(redis_sock, &key, &key_len TSRMLS_CC);
2895-
cmd_len = redis_cmd_format_static(&cmd, keyword, "sd", key, key_len, t);
2896+
cmd_len = redis_cmd_format_static(&cmd, keyword, "sl", key, key_len, t);
28962897
if(key_free) efree(key);
28972898

28982899
REDIS_PROCESS_REQUEST(redis_sock, cmd, cmd_len);

0 commit comments

Comments
 (0)