]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DIET/MINOR: obj: pack the obj_type enum to 8 bits
authorWilly Tarreau <w@1wt.eu>
Fri, 6 Dec 2013 20:08:11 +0000 (21:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 15:06:08 +0000 (16:06 +0100)
Taking 32-bit in each struct just to store an obj_type is a waste
considering the very small amount of possible values. Let's force
it to be as small as possible (1 char) and we'll be able to move
some structs around to save some space.

include/types/obj_type.h

index 09eaf4364bdd84463f4efeaf7ed1df190b1bc8f6..aefbcd3a164a1edaeff7ad81189b7f7a5cca098a 100644 (file)
@@ -30,7 +30,7 @@
  * various types of objects.
  */
 
-/* object types */
+/* object types : these ones take the same space as a char */
 enum obj_type {
        OBJ_TYPE_NONE = 0,     /* pointer is NULL by definition */
        OBJ_TYPE_LISTENER,     /* object is a struct listener */
@@ -40,7 +40,7 @@ enum obj_type {
        OBJ_TYPE_APPCTX,       /* object is a struct appctx */
        OBJ_TYPE_CONN,         /* object is a struct connection */
        OBJ_TYPE_ENTRIES       /* last one : number of entries */
-};
+} __attribute__((packed)) ;
 
 #endif /* _TYPES_OBJ_TYPE_H */