From e031e39c7c7f46b64671d11855569ed5e45672b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 10 Nov 2020 19:18:53 +0100 Subject: [PATCH] Fix sizeof(http_parser) assert on i386 The struct size is actually 28 bytes because the void* field is 4 bytes shorter. As the people on the original bug explained, x86 has lower alignment requirements than other arches, so the struct is not padded. However, this does not mean you can ignore the void* size difference. --- test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.c b/test.c index 3f7c77b3..49c4b7a0 100644 --- a/test.c +++ b/test.c @@ -4348,7 +4348,7 @@ main (void) /* Should be 32 on both 32 bits and 64 bits x86 because of struct padding, * see https://github.com/nodejs/http-parser/issues/507. */ - assert(sizeof(http_parser) == 32); + assert(sizeof(http_parser) == 24 + sizeof(void*)); #endif //// API