diff options
author | charsyam <charsyam@gmail.com> | 2013-03-28 14:41:46 -0700 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2013-03-29 10:33:52 +0100 |
commit | 86d87e355483314fdaa620e35c2804fe888f4094 (patch) | |
tree | b940dba93eedbe09c5bf1f265e78e318591832f0 /src/t_string.c | |
parent | dfc31a1ee8d89c962616e30c0f51fe90a81a7407 (diff) | |
download | redis-86d87e355483314fdaa620e35c2804fe888f4094.tar.gz |
Support for case unsensitive SET options.
Diffstat (limited to 'src/t_string.c')
-rw-r--r-- | src/t_string.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/t_string.c b/src/t_string.c index b619cbc7c..cbd069d3c 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -101,15 +101,19 @@ void setCommand(redisClient *c) { char *a = c->argv[j]->ptr; robj *next = (j == c->argc-1) ? NULL : c->argv[j+1]; - if (a[0] == 'n' && a[1] == 'x' && a[2] == '\0') { + if ((a[0] == 'n' || a[0] == 'N') && + (a[1] == 'x' || a[1] == 'X') && a[2] == '\0') { flags |= REDIS_SET_NX; - } else if (a[0] == 'x' && a[1] == 'x' && a[2] == '\0') { + } else if ((a[0] == 'x' || a[0] == 'X') && + (a[1] == 'x' || a[1] == 'X') && a[2] == '\0') { flags |= REDIS_SET_XX; - } else if (a[0] == 'e' && a[1] == 'x' && a[2] == '\0' && next) { + } else if ((a[0] == 'e' || a[0] == 'E') && + (a[1] == 'x' || a[1] == 'X') && a[2] == '\0' && next) { unit = UNIT_SECONDS; expire = next; j++; - } else if (a[0] == 'p' && a[1] == 'x' && a[2] == '\0' && next) { + } else if ((a[0] == 'p' || a[0] == 'P') && + (a[1] == 'x' || a[1] == 'X') && a[2] == '\0' && next) { unit = UNIT_MILLISECONDS; expire = next; j++; |