]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
authorJelle van der Waa <jelle@vdwaa.nl>
Sat, 22 Nov 2025 13:44:35 +0000 (14:44 +0100)
committerJelle van der Waa <jelle@vdwaa.nl>
Mon, 24 Nov 2025 20:05:10 +0000 (21:05 +0100)
No functional change, just refactoring.

src/shared/bootspec.c
src/shared/dns-rr.c
src/shared/userdb.c

index 12f67fbce1e8f27890e93aa974f50b5eea97cea2..46143020febcac6c0c3a7756cab674b6421e2091 100644 (file)
@@ -1770,8 +1770,8 @@ static int json_addon(
 
         r = sd_json_variant_append_arraybo(
                         array,
-                        SD_JSON_BUILD_PAIR(addon_str, SD_JSON_BUILD_STRING(addon->location)),
-                        SD_JSON_BUILD_PAIR("options", SD_JSON_BUILD_STRING(addon->cmdline)));
+                        SD_JSON_BUILD_PAIR_STRING(addon_str, addon->location),
+                        SD_JSON_BUILD_PAIR_STRING("options", addon->cmdline));
         if (r < 0)
                 return log_oom();
 
index a9f66927f90f0128fa8bfc204dc801d5b8f911a6..74ee7280ba20f54eb50a1797ea54f8961183074c 100644 (file)
@@ -2183,9 +2183,9 @@ int dns_resource_key_to_json(DnsResourceKey *key, sd_json_variant **ret) {
 
         return sd_json_buildo(
                         ret,
-                        SD_JSON_BUILD_PAIR("class", SD_JSON_BUILD_INTEGER(key->class)),
-                        SD_JSON_BUILD_PAIR("type", SD_JSON_BUILD_INTEGER(key->type)),
-                        SD_JSON_BUILD_PAIR("name", SD_JSON_BUILD_STRING(dns_resource_key_name(key))));
+                        SD_JSON_BUILD_PAIR_INTEGER("class", key->class),
+                        SD_JSON_BUILD_PAIR_INTEGER("type", key->type),
+                        SD_JSON_BUILD_PAIR_STRING("name", dns_resource_key_name(key)));
 }
 
 int dns_resource_key_from_json(sd_json_variant *v, DnsResourceKey **ret) {
index a6b4a5dae96fb9919becb49720835f3719a6ff79..8b58af655700e9ed1d6668cc20da195b50e7d4af 100644 (file)
@@ -701,8 +701,8 @@ static int synthetic_root_user_build(UserRecord **ret) {
         return user_record_buildo(
                         ret,
                         SD_JSON_BUILD_PAIR("userName", JSON_BUILD_CONST_STRING("root")),
-                        SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(0)),
-                        SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(0)),
+                        SD_JSON_BUILD_PAIR_UNSIGNED("uid", 0),
+                        SD_JSON_BUILD_PAIR_UNSIGNED("gid", 0),
                         SD_JSON_BUILD_PAIR("homeDirectory", JSON_BUILD_CONST_STRING("/root")),
                         SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("intrinsic")));
 }
@@ -711,10 +711,10 @@ static int synthetic_nobody_user_build(UserRecord **ret) {
         return user_record_buildo(
                         ret,
                         SD_JSON_BUILD_PAIR("userName", JSON_BUILD_CONST_STRING(NOBODY_USER_NAME)),
-                        SD_JSON_BUILD_PAIR("uid", SD_JSON_BUILD_UNSIGNED(UID_NOBODY)),
-                        SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(GID_NOBODY)),
+                        SD_JSON_BUILD_PAIR_UNSIGNED("uid", UID_NOBODY),
+                        SD_JSON_BUILD_PAIR_UNSIGNED("gid", GID_NOBODY),
                         SD_JSON_BUILD_PAIR("shell", JSON_BUILD_CONST_STRING(NOLOGIN)),
-                        SD_JSON_BUILD_PAIR("locked", SD_JSON_BUILD_BOOLEAN(true)),
+                        SD_JSON_BUILD_PAIR_BOOLEAN("locked", true),
                         SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("intrinsic")));
 }
 
@@ -1228,7 +1228,7 @@ static int synthetic_root_group_build(GroupRecord **ret) {
         return group_record_buildo(
                         ret,
                         SD_JSON_BUILD_PAIR("groupName", JSON_BUILD_CONST_STRING("root")),
-                        SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(0)),
+                        SD_JSON_BUILD_PAIR_UNSIGNED("gid", 0),
                         SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("intrinsic")));
 }
 
@@ -1236,7 +1236,7 @@ static int synthetic_nobody_group_build(GroupRecord **ret) {
         return group_record_buildo(
                         ret,
                         SD_JSON_BUILD_PAIR("groupName", JSON_BUILD_CONST_STRING(NOBODY_GROUP_NAME)),
-                        SD_JSON_BUILD_PAIR("gid", SD_JSON_BUILD_UNSIGNED(GID_NOBODY)),
+                        SD_JSON_BUILD_PAIR_UNSIGNED("gid", GID_NOBODY),
                         SD_JSON_BUILD_PAIR("disposition", JSON_BUILD_CONST_STRING("intrinsic")));
 }