From 431707b5b19cddeb846c68ca761e3a8c5f8b681d Mon Sep 17 00:00:00 2001 From: Joe Damato Date: Thu, 6 Aug 2009 23:17:30 -0700 Subject: [PATCH] fixing bitfield misuse --- http_parser.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/http_parser.h b/http_parser.h index b1d8ce6..9b699dc 100644 --- a/http_parser.h +++ b/http_parser.h @@ -70,8 +70,25 @@ struct http_parser { enum http_parser_type type; size_t chunk_size; - unsigned eating:1; - unsigned error:1; + + /** + XXX + do this so no other code has to change, but make the field only 1 byte wide + instead of 2 (on x86/x86_64). + + doing this not only shrinks the sizeof this struct by a byte but it ALSO + makes wrapping this in FFI way easier. + */ + union { + struct { + unsigned eating:1; + unsigned error:1; + }; + struct { + unsigned char _flags; + }; + }; + size_t body_read; const char *header_field_mark;