]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/json: make JsonVariant.type field wider
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 9 Feb 2021 16:08:06 +0000 (17:08 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Feb 2021 13:43:10 +0000 (14:43 +0100)
pahole shows that this doesn't make a difference, but we can fit -EINVAL
into .type without warnings.

src/shared/json.c

index fe322129931dcd6bcccd476144a44f200f1e9e37..b8f8292e74bc32833d4a9db574daa239fa26bed8 100644 (file)
@@ -64,7 +64,10 @@ struct JsonVariant {
         JsonSource *source;
         unsigned line, column;
 
-        JsonVariantType type:5;
+        /* The current 'depth' of the JsonVariant, i.e. how many levels of member variants this has */
+        uint16_t depth;
+
+        JsonVariantType type:8;
 
         /* A marker whether this variant is embedded into in array/object or not. If true, the 'parent' pointer above
          * is valid. If false, the 'n_ref' field above is valid instead. */
@@ -87,9 +90,6 @@ struct JsonVariant {
         /* If in addition to this object all objects referenced by it are also ordered strictly by name */
         bool normalized:1;
 
-        /* The current 'depth' of the JsonVariant, i.e. how many levels of member variants this has */
-        uint16_t depth;
-
         union {
                 /* For simple types we store the value in-line. */
                 JsonValue value;