From 399f74c79d27e06f22908bfbffbb28e207f5810b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 9 Feb 2021 19:51:50 +0100 Subject: [PATCH] sd-netlink: pahole optimization of sd_netlink_slot By rearranging the fields, we can avoid one of the holes (on amd64). By adding more space for .type, -EINVAL can be used as a value later on. The structure is reduced from 96 to 88 bytes (on amd64). Text size is also smaller: -rwxrwxr-x 1 zbyszek zbyszek 4109832 Feb 9 19:50 build/libsystemd.so.0.30.0 -rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 9 19:51 build/libsystemd.so.0.30.0 --- src/libsystemd/sd-netlink/netlink-internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h index efd0cf93358..9159f94dd9a 100644 --- a/src/libsystemd/sd-netlink/netlink-internal.h +++ b/src/libsystemd/sd-netlink/netlink-internal.h @@ -38,12 +38,12 @@ typedef enum NetlinkSlotType { struct sd_netlink_slot { unsigned n_ref; + NetlinkSlotType type:8; + bool floating; sd_netlink *netlink; void *userdata; sd_netlink_destroy_t destroy_callback; - NetlinkSlotType type:2; - bool floating:1; char *description; LIST_FIELDS(sd_netlink_slot, slots); -- 2.47.3