diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-04-21 11:14:48 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-04-21 11:16:32 -0700 |
commit | b5ff27899a3caf8a66be1d024e727ac166dd3b3f (patch) | |
tree | a0902589a3a2a0e2f88e3ba38af6c8b404cf13a2 /ext/unicorn/http11/http11_parser.rl | |
parent | cd0c49fbc22aa4b13f8c11917d8fd01e9c31eb2e (diff) | |
download | unicorn-b5ff27899a3caf8a66be1d024e727ac166dd3b3f.tar.gz |
While we're at it, replace a bunch of zero assignments with a memset to avoid forgetting a struct element in case we change the struct.
Diffstat (limited to 'ext/unicorn/http11/http11_parser.rl')
-rw-r--r-- | ext/unicorn/http11/http11_parser.rl | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/ext/unicorn/http11/http11_parser.rl b/ext/unicorn/http11/http11_parser.rl index 5f4422f..991ba58 100644 --- a/ext/unicorn/http11/http11_parser.rl +++ b/ext/unicorn/http11/http11_parser.rl @@ -107,21 +107,15 @@ static void downcase_char(char *c) /** Data **/ %% write data; -static int http_parser_init(http_parser *parser) { +static void http_parser_init(http_parser *parser) { int cs = 0; + memset(parser, 0, sizeof(*parser)); %% write init; parser->cs = cs; - parser->body_start = 0; - parser->mark = 0; - parser->nread = 0; - parser->field_len = 0; - parser->field_start = 0; - - return(1); } /** exec **/ -static size_t http_parser_execute( +static void http_parser_execute( http_parser *parser, const char *buffer, size_t len) { const char *p, *pe; @@ -148,8 +142,6 @@ static size_t http_parser_execute( assert(parser->mark < len && "mark is after buffer end"); assert(parser->field_len <= len && "field has length longer than whole buffer"); assert(parser->field_start < len && "field starts after buffer end"); - - return(parser->nread); } static int http_parser_has_error(http_parser *parser) { |