]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: drop unnecessary use of dummy_t
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 May 2025 18:44:18 +0000 (03:44 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Jun 2025 04:13:14 +0000 (13:13 +0900)
Then, make flex arrays to zero-length arrays, as union cannot have
flex arrays, even though flex and zero-length arrays are effectively
equivalent.

src/libsystemd/sd-journal/journal-def.h

index 8cd0843197ef53aab3d4f6240f31a910dfa13bb2..96c193c3fda76b7d65108373d98546793e2b80da 100644 (file)
@@ -104,18 +104,13 @@ assert_cc(sizeof(struct FieldObject) == sizeof(struct FieldObject__packed));
         le64_t xor_hash;                               \
         union {                                        \
                 struct {                               \
-                        dummy_t __empty__regular;      \
-                        struct {                       \
-                                le64_t object_offset;  \
-                                le64_t hash;           \
-                        } regular[];                   \
-                };                                     \
+                        le64_t object_offset;          \
+                        le64_t hash;                   \
+                } regular[0]; /* this is an array; since we are not allowed to place a variable sized array
+                               * in a union, we just zero-size it, even if it is generally longer. */ \
                 struct {                               \
-                        dummy_t __empty_compact;       \
-                        struct {                       \
-                                le32_t object_offset;  \
-                        } compact[];                   \
-                };                                     \
+                        le32_t object_offset;          \
+                } compact[0];                          \
         } items;                                       \
 }