From 0e5b77af2c0f6253025afbdb77aff38a02e30602 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Sat, 7 Dec 2013 20:56:32 +0100 Subject: hashmap.h: make sure map entries are tightly packed Extending 'struct hashmap_entry' with an int-sized member shouldn't waste memory on 64-bit systems. This is already documented in api-hashmap.txt, but needs '__attribute__((__packed__))' to work. Reduces e.g. struct name_entry { struct hashmap_entry ent; int namelen; char *name; }; from 32 to 24 bytes. Signed-off-by: Karsten Blees Signed-off-by: Junio C Hamano --- hashmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hashmap.h b/hashmap.h index a816ad47b1..b64567bc17 100644 --- a/hashmap.h +++ b/hashmap.h @@ -15,7 +15,7 @@ extern unsigned int memihash(const void *buf, size_t len); /* data structures */ -struct hashmap_entry { +struct __attribute__((__packed__)) hashmap_entry { struct hashmap_entry *next; unsigned int hash; }; -- cgit v1.2.1