shared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()

No functional change, just refactoring.
This commit is contained in:
Jelle van der Waa
2025-11-22 14:44:35 +01:00
parent 18615041a5
commit 21ebaaf627
3 changed files with 12 additions and 12 deletions

View 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();

View 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) {

View 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")));
}