From ed10f40b1520cef2fa633c94289ff9f3241bb3f6 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 15 Dec 2009 09:33:29 -0500 Subject: [PATCH] Unified handling of empty queries with normal queries. --- redis.c | 6 ------ sds.c | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/redis.c b/redis.c index 61bb81cf..f0b69edd 100644 --- a/redis.c +++ b/redis.c @@ -1877,12 +1877,6 @@ again: sdsupdatelen(query); /* Now we can split the query in arguments */ - if (sdslen(query) == 0) { - /* Ignore empty query */ - sdsfree(query); - if (sdslen(c->querybuf)) goto again; - return; - } argv = sdssplitlen(query,sdslen(query)," ",1,&argc); sdsfree(query); diff --git a/sds.c b/sds.c index 8e9fd96d..6d18d1fd 100644 --- a/sds.c +++ b/sds.c @@ -277,6 +277,10 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) { if (tokens == NULL) sdsOomAbort(); #endif if (seplen < 1 || len < 0 || tokens == NULL) return NULL; + if (len == 0) { + *count = 0; + return tokens; + } for (j = 0; j < (len-(seplen-1)); j++) { /* make sure there is room for the next element and the final one */ if (slots < elements+2) { -- 2.45.2