From c730fd7ddd222b03fe3c0dae77c64131b5ac49b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 14 May 2025 15:09:09 +0200 Subject: [PATCH 1/3] elf2efi: make code more pythonic Follow-up for 53628612b75b444681fabc729ad7b012299c4c63. With 'or', we ignore the empty string (but not '0'), and we only call time.time() lazily. So this works the same as the code that is replaced, but avoids the ugly repetition. --- tools/elf2efi.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/elf2efi.py b/tools/elf2efi.py index fff2b1a4be..d3ef5907b2 100755 --- a/tools/elf2efi.py +++ b/tools/elf2efi.py @@ -611,9 +611,7 @@ def elf2efi(args: argparse.Namespace): coff.Machine = pe_arch coff.NumberOfSections = len(sections) - coff.TimeDateStamp = int( - os.environ.get("SOURCE_DATE_EPOCH") if os.environ.get("SOURCE_DATE_EPOCH") else time.time() - ) + coff.TimeDateStamp = int(os.environ.get("SOURCE_DATE_EPOCH") or time.time()) coff.SizeOfOptionalHeader = sizeof(opt) # EXECUTABLE_IMAGE|LINE_NUMS_STRIPPED|LOCAL_SYMS_STRIPPED|DEBUG_STRIPPED # and (32BIT_MACHINE or LARGE_ADDRESS_AWARE) From 1a47f96a8d5a9a2b7dbd9e4b57c096d92f3a94e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 14 May 2025 15:49:44 +0200 Subject: [PATCH 2/3] systemd-journald: drop pointless bitfield annotations This actually doesn't change the struct size, because bools are coalesced anyway. Also group the bool fields together. --- src/journal/journald-manager.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/journal/journald-manager.h b/src/journal/journald-manager.h index 32412fc6a1..ceaa11801c 100644 --- a/src/journal/journald-manager.h +++ b/src/journal/journald-manager.h @@ -115,9 +115,13 @@ typedef struct Manager { JournalStorage system_storage; JournalCompressOptions compress; + int set_audit; bool seal; bool read_kmsg; - int set_audit; + + bool send_watchdog; + bool sent_notify_ready; + bool sync_scheduled; bool forward_to_kmsg; bool forward_to_syslog; @@ -155,10 +159,6 @@ typedef struct Manager { uint64_t *kernel_seqnum; RateLimit kmsg_own_ratelimit; - bool send_watchdog:1; - bool sent_notify_ready:1; - bool sync_scheduled:1; - char machine_id_field[STRLEN("_MACHINE_ID=") + SD_ID128_STRING_MAX]; char boot_id_field[STRLEN("_BOOT_ID=") + SD_ID128_STRING_MAX]; char *hostname_field; From 81d7934882ae13c64d9b08d365a0baa011cb2fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 14 May 2025 16:39:32 +0200 Subject: [PATCH 3/3] fundamental: assume that intmax_t is the biggest integer Allowing intmax_t to be narrower than some other type in the assert is rather strange. By definition, it is the widest type. Follow-up for c0239e5f113335f49328286698d4a9f13fed983d. --- src/fundamental/macro-fundamental.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index 54b3e6a651..40c84a2efd 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -173,7 +173,7 @@ #else # define ABS(a) __builtin_imaxabs(a) #endif -assert_cc(sizeof(intmax_t) <= sizeof(long long)); +assert_cc(sizeof(long long) == sizeof(intmax_t)); #define IS_UNSIGNED_INTEGER_TYPE(type) \ (__builtin_types_compatible_p(typeof(type), unsigned char) || \