mirror of
https://github.com/fluencelabs/redis
synced 2025-05-12 02:37:11 +00:00
Unified handling of empty queries with normal queries.
This commit is contained in:
parent
7c49733ce3
commit
ed10f40b15
6
redis.c
6
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);
|
||||
|
||||
|
4
sds.c
4
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user