diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-08-01 01:16:14 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-08-09 01:19:02 -0700 |
commit | 00f1a1d8c9dcd1eefff2e61bb65142d7ca870c84 (patch) | |
tree | 3b4dd311f8e18ade12a118686e0caa3713b1c143 /ext | |
parent | 56f613183dd36c2b6cfe9e1745b842a3f004c408 (diff) | |
download | unicorn-00f1a1d8c9dcd1eefff2e61bb65142d7ca870c84.tar.gz |
typedefs can be misleading for aggregate types, a struct is a struct.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/unicorn_http/unicorn_http.c | 12 | ||||
-rw-r--r-- | ext/unicorn_http/unicorn_http.rl | 16 |
2 files changed, 14 insertions, 14 deletions
diff --git a/ext/unicorn_http/unicorn_http.c b/ext/unicorn_http/unicorn_http.c index 51ddeaa..5764ef5 100644 --- a/ext/unicorn_http/unicorn_http.c +++ b/ext/unicorn_http/unicorn_http.c @@ -7,11 +7,11 @@ #include <string.h> #include "unicorn_http.h" -static http_parser *data_get(VALUE self) +static struct http_parser *data_get(VALUE self) { - http_parser *http; + struct http_parser *http; - Data_Get_Struct(self, http_parser, http); + Data_Get_Struct(self, struct http_parser, http); assert(http); return http; } @@ -308,8 +308,8 @@ static void header_done(VALUE req, const char *at, size_t length) static VALUE HttpParser_alloc(VALUE klass) { - http_parser *hp; - return Data_Make_Struct(klass, http_parser, NULL, NULL, hp); + struct http_parser *http; + return Data_Make_Struct(klass, struct http_parser, NULL, NULL, http); } @@ -357,7 +357,7 @@ static VALUE HttpParser_reset(VALUE self) static VALUE HttpParser_execute(VALUE self, VALUE req, VALUE data) { - http_parser *http = data_get(self); + struct http_parser *http = data_get(self); char *dptr = RSTRING_PTR(data); long dlen = RSTRING_LEN(data); diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl index ceb4073..40406c6 100644 --- a/ext/unicorn_http/unicorn_http.rl +++ b/ext/unicorn_http/unicorn_http.rl @@ -21,7 +21,7 @@ static void query_string(VALUE req, const char *at, size_t length); static void http_version(VALUE req, const char *at, size_t length); static void header_done(VALUE req, const char *at, size_t length); -typedef struct http_parser { +struct http_parser { int cs; union { size_t body; @@ -31,10 +31,10 @@ typedef struct http_parser { } start; size_t mark; size_t field_len; -} http_parser; +}; -static int http_parser_has_error(http_parser *parser); -static int http_parser_is_finished(http_parser *parser); +static int http_parser_has_error(struct http_parser *parser); +static int http_parser_is_finished(struct http_parser *parser); /* * capitalizes all lower-case ASCII characters, @@ -103,7 +103,7 @@ static void downcase_char(char *c) /** Data **/ %% write data; -static void http_parser_init(http_parser *parser) { +static void http_parser_init(struct http_parser *parser) { int cs = 0; memset(parser, 0, sizeof(*parser)); %% write init; @@ -112,7 +112,7 @@ static void http_parser_init(http_parser *parser) { /** exec **/ static void http_parser_execute( - http_parser *parser, VALUE req, const char *buffer, size_t len) + struct http_parser *parser, VALUE req, const char *buffer, size_t len) { const char *p, *pe; int cs = parser->cs; @@ -138,11 +138,11 @@ static void http_parser_execute( assert(parser->field_len <= len && "field has length longer than whole buffer"); } -static int http_parser_has_error(http_parser *parser) { +static int http_parser_has_error(struct http_parser *parser) { return parser->cs == http_parser_error; } -static int http_parser_is_finished(http_parser *parser) { +static int http_parser_is_finished(struct http_parser *parser) { return parser->cs == http_parser_first_final; } #endif /* unicorn_http_h */ |