From: Jelle van der Waa Date: Sat, 22 Nov 2025 13:44:35 +0000 (+0100) Subject: shared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR() X-Git-Tag: v259-rc2~5^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21ebaaf6279a33e3ccb86e0a947840c7839ef042;p=thirdparty%2Fsystemd.git shared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR() No functional change, just refactoring. --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 12f67fbce1e..46143020feb 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -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(); diff --git a/src/shared/dns-rr.c b/src/shared/dns-rr.c index a9f66927f90..74ee7280ba2 100644 --- a/src/shared/dns-rr.c +++ b/src/shared/dns-rr.c @@ -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) { diff --git a/src/shared/userdb.c b/src/shared/userdb.c index a6b4a5dae96..8b58af65570 100644 --- a/src/shared/userdb.c +++ b/src/shared/userdb.c @@ -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"))); }