Commit a69942cc authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

Style

parent 4d3f9aa1
...@@ -135,13 +135,14 @@ void redis_parser_init(redis_parser_t *parser, const redis_parser_callbacks_t *c ...@@ -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, /* 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 * the "dst" pointer is populated with the address of the root payload object.
* address is a static offset in the redis_parser_t struct, but may change in * This pointer is set to NULL when no full message could be parsed.
* 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 * This function returns the number of bytes that could be parsed. When no full
* no full message was parsed and the return value is smaller than the number * message was parsed and the return value is smaller than the number of bytes
* of bytes that were available, an error occured and the parser should be * that were available, an error occured and the parser should be
* re-initialized before parsing more data. */ * 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) { 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; redis_protocol_t *stack = parser->stack;
const redis_parser_callbacks_t *callbacks = parser->callbacks; const redis_parser_callbacks_t *callbacks = parser->callbacks;
......
...@@ -52,10 +52,10 @@ typedef enum redis_parser_err_e { ...@@ -52,10 +52,10 @@ typedef enum redis_parser_err_e {
struct redis_protocol_s { struct redis_protocol_s {
unsigned char type; /* payload type */ 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 */ const redis_protocol_t* parent; /* when nested, parent object */
int remaining; /* remaining bulk bytes/nested objects */ int remaining; /* remaining bulk bytes/nested objects */
int cursor; /* number of processed bulk bytes/nested objects */ int cursor; /* number of processed bulk bytes/nested objects */
void *data; /* user data */
size_t poff; /* protocol offset */ size_t poff; /* protocol offset */
size_t plen; /* protocol length */ size_t plen; /* protocol length */
size_t coff; /* content offset */ size_t coff; /* content offset */
......
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