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
b9427f41
Commit
b9427f41
authored
Jun 30, 2011
by
Pieter Noordhuis
Browse files
Pass pointer to redis_protocol_t when message was read
parent
d96c4c9e
Changes
1
Show whitespace changes
Inline
Side-by-side
parser.c
View file @
b9427f41
...
...
@@ -110,6 +110,9 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
int
stackidx
;
unsigned
char
state
;
/* Reset destination */
if
(
dst
)
*
dst
=
NULL
;
/* Reset root protocol object for new messages */
if
(
parser
->
stackidx
==
-
1
)
{
RESET_PROTOCOL_T
(
&
stack
[
0
]);
...
...
@@ -321,10 +324,20 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
}
}
error:
/* Set destination pointer when full message was read */
if
(
stackidx
==
-
1
)
{
if
(
dst
)
*
dst
=
&
stack
[
0
];
}
finalize:
parser
->
nread
=
nread
;
parser
->
stackidx
=
stackidx
;
parser
->
state
=
state
;
return
pos
-
buf
;
error:
/* TODO: set some kind of error */
goto
finalize
;
}
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