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
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-02-10 14:43:10 +01:00
parent 4d24463211
commit 399f74c79d
+2 -2
View File
@@ -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);