Permalink
Browse files

Fix keyspace events flags-to-string conversion.

Fixes issue #1491 on Github.
  • Loading branch information...
1 parent 05d219a commit 51f71e2d8ee96b7da8e710e16ab01cf69e4ec95f @antirez committed Jan 8, 2014
Showing with 12 additions and 10 deletions.
  1. +12 −10 src/notify.c
View
@@ -67,17 +67,19 @@ int keyspaceEventsStringToFlags(char *classes) {
sds keyspaceEventsFlagsToString(int flags) {
sds res;
- if ((flags & REDIS_NOTIFY_ALL) == REDIS_NOTIFY_ALL)
- return sdsnew("A");
res = sdsempty();
- if (flags & REDIS_NOTIFY_GENERIC) res = sdscatlen(res,"g",1);
- if (flags & REDIS_NOTIFY_STRING) res = sdscatlen(res,"$",1);
- if (flags & REDIS_NOTIFY_LIST) res = sdscatlen(res,"l",1);
- if (flags & REDIS_NOTIFY_SET) res = sdscatlen(res,"s",1);
- if (flags & REDIS_NOTIFY_HASH) res = sdscatlen(res,"h",1);
- if (flags & REDIS_NOTIFY_ZSET) res = sdscatlen(res,"z",1);
- if (flags & REDIS_NOTIFY_EXPIRED) res = sdscatlen(res,"x",1);
- if (flags & REDIS_NOTIFY_EVICTED) res = sdscatlen(res,"e",1);
+ if ((flags & REDIS_NOTIFY_ALL) == REDIS_NOTIFY_ALL) {
+ res = sdscatlen(res,"A",1);
+ } else {
+ if (flags & REDIS_NOTIFY_GENERIC) res = sdscatlen(res,"g",1);
+ if (flags & REDIS_NOTIFY_STRING) res = sdscatlen(res,"$",1);
+ if (flags & REDIS_NOTIFY_LIST) res = sdscatlen(res,"l",1);
+ if (flags & REDIS_NOTIFY_SET) res = sdscatlen(res,"s",1);
+ if (flags & REDIS_NOTIFY_HASH) res = sdscatlen(res,"h",1);
+ if (flags & REDIS_NOTIFY_ZSET) res = sdscatlen(res,"z",1);
+ if (flags & REDIS_NOTIFY_EXPIRED) res = sdscatlen(res,"x",1);
+ if (flags & REDIS_NOTIFY_EVICTED) res = sdscatlen(res,"e",1);
+ }
if (flags & REDIS_NOTIFY_KEYSPACE) res = sdscatlen(res,"K",1);
if (flags & REDIS_NOTIFY_KEYEVENT) res = sdscatlen(res,"E",1);
return res;

0 comments on commit 51f71e2

Please sign in to comment.