Commit 032ed29a authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

Inner while loop is no longer useful

parent 37c16d6d
...@@ -127,6 +127,8 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons ...@@ -127,6 +127,8 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
int stackidx; int stackidx;
unsigned char state; unsigned char state;
struct redis_parser_int64_s i64; struct redis_parser_int64_s i64;
redis_protocol_t *cur;
char ch;
/* Reset destination */ /* Reset destination */
if (dst) *dst = NULL; if (dst) *dst = NULL;
...@@ -148,13 +150,9 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons ...@@ -148,13 +150,9 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
i64 = parser->i64; i64 = parser->i64;
while (pos < end && stackidx >= 0) { while (pos < end && stackidx >= 0) {
redis_protocol_t *cur = &stack[stackidx]; cur = &stack[stackidx];
cur->parent = stackidx > 0 ? &stack[stackidx-1] : NULL; cur->parent = stackidx > 0 ? &stack[stackidx-1] : NULL;
ch = *pos;
while (pos < end) {
char ch = *pos;
LOG("state: %-18s char: %4s", strstate[state], chrtos(ch));
switch (state) { switch (state) {
case s_type_char: case s_type_char:
...@@ -330,9 +328,6 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons ...@@ -330,9 +328,6 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
goto error; goto error;
} }
default:
assert(NULL);
} }
/* Transitions should be made from within the switch */ /* Transitions should be made from within the switch */
...@@ -357,12 +352,10 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons ...@@ -357,12 +352,10 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
stackidx--; stackidx--;
} }
/* When an object is done, always move back to start state */ /* Always move back to start state */
state = s_type_char; state = s_type_char;
pos++; nread++; pos++; nread++;
break; continue;
}
} }
/* Set destination pointer when full message was read */ /* Set destination pointer when full message was read */
......
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