Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
032ed29a
Commit
032ed29a
authored
Jul 02, 2011
by
Pieter Noordhuis
Browse files
Inner while loop is no longer useful
parent
37c16d6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
parser.c
View file @
032ed29a
...
@@ -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,15 +150,11 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
...
@@ -148,15 +150,11 @@ 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
)
{
switch
(
state
)
{
char
ch
=
*
pos
;
LOG
(
"state: %-18s char: %4s"
,
strstate
[
state
],
chrtos
(
ch
));
switch
(
state
)
{
case
s_type_char
:
case
s_type_char
:
l_type_char:
l_type_char:
{
{
...
@@ -330,13 +328,10 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
...
@@ -330,13 +328,10 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
goto
error
;
goto
error
;
}
}
}
default:
/* Transitions should be made from within the switch */
assert
(
NULL
);
assert
(
NULL
&&
"invalid code path"
);
}
/* Transitions should be made from within the switch */
assert
(
NULL
&&
"invalid code path"
);
done:
done:
/* Message is done when root object is done */
/* Message is done when root object is done */
...
@@ -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, a
lways move back to start state */
/*
A
lways 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 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment