Commit 59b30b32 authored by antirez's avatar antirez
Browse files

SCAN: no sdsEncodedObject() API in Redis 2.8.

parent 3d3e350b
...@@ -475,16 +475,16 @@ void scanGenericCommand(redisClient *c, robj *o) { ...@@ -475,16 +475,16 @@ void scanGenericCommand(redisClient *c, robj *o) {
/* Filter element if it does not match the pattern. */ /* Filter element if it does not match the pattern. */
if (!filter && use_pattern) { if (!filter && use_pattern) {
if (sdsEncodedObject(kobj)) { if (kobj->encoding == REDIS_ENCODING_INT) {
if (!stringmatchlen(pat, patlen, kobj->ptr, sdslen(kobj->ptr), 0))
filter = 1;
} else {
char buf[REDIS_LONGSTR_SIZE]; char buf[REDIS_LONGSTR_SIZE];
int len; int len;
redisAssert(kobj->encoding == REDIS_ENCODING_INT); redisAssert(kobj->encoding == REDIS_ENCODING_INT);
len = ll2string(buf,sizeof(buf),(long)kobj->ptr); len = ll2string(buf,sizeof(buf),(long)kobj->ptr);
if (!stringmatchlen(pat, patlen, buf, len, 0)) filter = 1; if (!stringmatchlen(pat, patlen, buf, len, 0)) filter = 1;
} else {
if (!stringmatchlen(pat, patlen, kobj->ptr, sdslen(kobj->ptr), 0))
filter = 1;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment