From 38d1e120636bf6c998ea0e5be5524e40e38716e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 10 Feb 2021 14:03:10 +0100 Subject: [PATCH] sd-bus: drop some bitfields in sd_bus_slot A hole was/is present after the booleans, so changing them to be one byte each doesn't change the structure size (122 bits on amd64). If we add more stuff later, it might make sense to turn some of those into bitfields again. For now, let's take the easy route. EINVAL fits into type now. Code size it minimally reduced: -rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 10 14:00 build/libsystemd.so.0.30.0 -rwxrwxr-x 1 zbyszek zbyszek 4109712 Feb 10 14:01 build/libsystemd.so.0.30.0 --- src/libsystemd/sd-bus/bus-internal.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h index 82fa97fc5d8..b9cebf2a025 100644 --- a/src/libsystemd/sd-bus/bus-internal.h +++ b/src/libsystemd/sd-bus/bus-internal.h @@ -127,17 +127,17 @@ typedef enum BusSlotType { struct sd_bus_slot { unsigned n_ref; - BusSlotType type:5; - - /* Slots can be "floating" or not. If they are not floating (the usual case) then they reference the bus object - * they are associated with. This means the bus object stays allocated at least as long as there is a slot - * around associated with it. If it is floating, then the slot's lifecycle is bound to the lifecycle of the - * bus: it will be disconnected from the bus when the bus is destroyed, and it keeping the slot reffed hence - * won't mean the bus stays reffed too. Internally this means the reference direction is reversed: floating - * slots objects are referenced by the bus object, and not vice versa. */ - bool floating:1; - - bool match_added:1; + BusSlotType type:8; + + /* Slots can be "floating" or not. If they are not floating (the usual case) then they reference the + * bus object they are associated with. This means the bus object stays allocated at least as long as + * there is a slot around associated with it. If it is floating, then the slot's lifecycle is bound + * to the lifecycle of the bus: it will be disconnected from the bus when the bus is destroyed, and + * it keeping the slot reffed hence won't mean the bus stays reffed too. Internally this means the + * reference direction is reversed: floating slots objects are referenced by the bus object, and not + * vice versa. */ + bool floating; + bool match_added; sd_bus *bus; void *userdata; -- 2.47.3