From: Zbigniew Jędrzejewski-Szmek Date: Wed, 29 Apr 2026 08:54:43 +0000 (+0200) Subject: sd-varlink: drop pointless bitfield X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01bf2b9f523d3bcddf74cac6af4ac5c36ce75550;p=thirdparty%2Fsystemd.git sd-varlink: drop pointless bitfield As is often the case, in this case because of alignment, we are actually not saving any space. With the bitfield we are using one bit of the 8 bytes allocated, and without the bitfield we are using 8 bits of that. But we're paying a price in generated code, at every access site to the field: $ diff <(objdump -S build/libsystemd.so.old) <(objdump -S build/libsystemd.so.new) ... v->protocol_upgrade = false; - fa2d2: 48 8b 45 a8 mov -0x58(%rbp),%rax - fa2d6: 0f b6 90 90 01 00 00 movzbl 0x190(%rax),%edx - fa2dd: 83 e2 fe and $0xfffffffe,%edx - fa2e0: 88 90 90 01 00 00 mov %dl,0x190(%rax) + fa2a9: 48 8b 45 a8 mov -0x58(%rbp),%rax + fa2ad: c6 80 90 01 00 00 00 movb $0x0,0x190(%rax) --- diff --git a/src/libsystemd/sd-varlink/varlink-internal.h b/src/libsystemd/sd-varlink/varlink-internal.h index 8087c2c4324..ff359852f48 100644 --- a/src/libsystemd/sd-varlink/varlink-internal.h +++ b/src/libsystemd/sd-varlink/varlink-internal.h @@ -107,7 +107,7 @@ typedef struct sd_varlink { * ensure the caller's contract is honored. The transport-layer "stop reading at the * next message boundary" behavior is governed independently by the JsonStream's * bounded_reads flag. */ - bool protocol_upgrade:1; + bool protocol_upgrade; void *userdata;