diff options
Diffstat (limited to 'src/shared/discover-image.c')
-rw-r--r-- | src/shared/discover-image.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/shared/discover-image.c b/src/shared/discover-image.c index 1079d28200..4813973d17 100644 --- a/src/shared/discover-image.c +++ b/src/shared/discover-image.c @@ -1644,22 +1644,22 @@ bool image_in_search_path( return false; } -int image_to_json(const struct Image *img, JsonVariant **ret) { +int image_to_json(const struct Image *img, sd_json_variant **ret) { assert(img); - return json_build(ret, - JSON_BUILD_OBJECT( - JSON_BUILD_PAIR_STRING("Type", image_type_to_string(img->type)), - JSON_BUILD_PAIR_STRING("Class", image_class_to_string(img->class)), - JSON_BUILD_PAIR_STRING("Name", img->name), - JSON_BUILD_PAIR_CONDITION(img->path, "Path", JSON_BUILD_STRING(img->path)), - JSON_BUILD_PAIR_BOOLEAN("ReadOnly", img->read_only), - JSON_BUILD_PAIR_CONDITION(img->crtime != 0, "CreationTimestamp", JSON_BUILD_UNSIGNED(img->crtime)), - JSON_BUILD_PAIR_CONDITION(img->mtime != 0, "ModificationTimestamp", JSON_BUILD_UNSIGNED(img->mtime)), - JSON_BUILD_PAIR_CONDITION(img->usage != UINT64_MAX, "Usage", JSON_BUILD_UNSIGNED(img->usage)), - JSON_BUILD_PAIR_CONDITION(img->usage_exclusive != UINT64_MAX, "UsageExclusive", JSON_BUILD_UNSIGNED(img->usage_exclusive)), - JSON_BUILD_PAIR_CONDITION(img->limit != UINT64_MAX, "Limit", JSON_BUILD_UNSIGNED(img->limit)), - JSON_BUILD_PAIR_CONDITION(img->limit_exclusive != UINT64_MAX, "LimitExclusive", JSON_BUILD_UNSIGNED(img->limit_exclusive)))); + return sd_json_build(ret, + SD_JSON_BUILD_OBJECT( + SD_JSON_BUILD_PAIR_STRING("Type", image_type_to_string(img->type)), + SD_JSON_BUILD_PAIR_STRING("Class", image_class_to_string(img->class)), + SD_JSON_BUILD_PAIR_STRING("Name", img->name), + SD_JSON_BUILD_PAIR_CONDITION(!!img->path, "Path", SD_JSON_BUILD_STRING(img->path)), + SD_JSON_BUILD_PAIR_BOOLEAN("ReadOnly", img->read_only), + SD_JSON_BUILD_PAIR_CONDITION(img->crtime != 0, "CreationTimestamp", SD_JSON_BUILD_UNSIGNED(img->crtime)), + SD_JSON_BUILD_PAIR_CONDITION(img->mtime != 0, "ModificationTimestamp", SD_JSON_BUILD_UNSIGNED(img->mtime)), + SD_JSON_BUILD_PAIR_CONDITION(img->usage != UINT64_MAX, "Usage", SD_JSON_BUILD_UNSIGNED(img->usage)), + SD_JSON_BUILD_PAIR_CONDITION(img->usage_exclusive != UINT64_MAX, "UsageExclusive", SD_JSON_BUILD_UNSIGNED(img->usage_exclusive)), + SD_JSON_BUILD_PAIR_CONDITION(img->limit != UINT64_MAX, "Limit", SD_JSON_BUILD_UNSIGNED(img->limit)), + SD_JSON_BUILD_PAIR_CONDITION(img->limit_exclusive != UINT64_MAX, "LimitExclusive", SD_JSON_BUILD_UNSIGNED(img->limit_exclusive)))); } static const char* const image_type_table[_IMAGE_TYPE_MAX] = { |