Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
a69942cc
Commit
a69942cc
authored
Jul 24, 2011
by
Pieter Noordhuis
Browse files
Style
parent
4d3f9aa1
Changes
2
Hide whitespace changes
Inline
Side-by-side
parser.c
View file @
a69942cc
...
...
@@ -135,13 +135,14 @@ void redis_parser_init(redis_parser_t *parser, const redis_parser_callbacks_t *c
}
/* Execute the parser against len bytes in buf. When a full message was read,
* the "dst" pointer is populated with the address of the root object (this
* address is a static offset in the redis_parser_t struct, but may change in
* the future). This pointer is set to NULL when no full message could be
* parsed. This function returns the number of bytes that could be parsed. When
* no full message was parsed and the return value is smaller than the number
* of bytes that were available, an error occured and the parser should be
* re-initialized before parsing more data. */
* the "dst" pointer is populated with the address of the root payload object.
* This pointer is set to NULL when no full message could be parsed.
*
* This function returns the number of bytes that could be parsed. When no full
* message was parsed and the return value is smaller than the number of bytes
* that were available, an error occured and the parser should be
* re-initialized before parsing more data.
*/
size_t
redis_parser_execute
(
redis_parser_t
*
parser
,
redis_protocol_t
**
dst
,
const
char
*
buf
,
size_t
len
)
{
redis_protocol_t
*
stack
=
parser
->
stack
;
const
redis_parser_callbacks_t
*
callbacks
=
parser
->
callbacks
;
...
...
parser.h
View file @
a69942cc
...
...
@@ -52,10 +52,10 @@ typedef enum redis_parser_err_e {
struct
redis_protocol_s
{
unsigned
char
type
;
/* payload type */
void
*
data
;
/* payload data (to be populated by the callback functions) */
const
redis_protocol_t
*
parent
;
/* when nested, parent object */
int
remaining
;
/* remaining bulk bytes/nested objects */
int
cursor
;
/* number of processed bulk bytes/nested objects */
void
*
data
;
/* user data */
size_t
poff
;
/* protocol offset */
size_t
plen
;
/* protocol length */
size_t
coff
;
/* content offset */
...
...
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