From: Daan De Meyer Date: Wed, 12 Jul 2023 17:46:46 +0000 (+0200) Subject: logs-show: Rename json_data to JsonData and add typedef X-Git-Tag: v254-rc2~36^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28365%2Fhead;p=thirdparty%2Fsystemd.git logs-show: Rename json_data to JsonData and add typedef --- diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 1c5b212b01e..7582dc9ace4 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -936,13 +936,13 @@ void json_escape( } } -struct json_data { +typedef struct JsonData { JsonVariant* name; size_t n_values; JsonVariant* values[]; -}; +} JsonData; -static struct json_data* json_data_free(struct json_data *d) { +static JsonData* json_data_free(struct JsonData *d) { if (!d) return NULL; @@ -956,7 +956,7 @@ static struct json_data* json_data_free(struct json_data *d) { DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(json_data_hash_ops_free, char, string_hash_func, string_compare_func, - struct json_data, json_data_free); + JsonData, json_data_free); static int update_json_data( Hashmap *h, @@ -966,7 +966,7 @@ static int update_json_data( size_t size) { _cleanup_(json_variant_unrefp) JsonVariant *v = NULL; - struct json_data *d = NULL; + JsonData *d = NULL; int r; assert(name); @@ -986,9 +986,9 @@ static int update_json_data( d = hashmap_get(h, name); if (d) { - struct json_data *w; + JsonData *w; - w = realloc(d, offsetof(struct json_data, values) + sizeof(JsonVariant*) * (d->n_values + 1)); + w = realloc(d, offsetof(JsonData, values) + sizeof(JsonVariant*) * (d->n_values + 1)); if (!w) return log_oom(); @@ -1001,7 +1001,7 @@ static int update_json_data( if (r < 0) return log_error_errno(r, "Failed to allocate JSON name variant: %m"); - d = malloc0(offsetof(struct json_data, values) + sizeof(JsonVariant*)); + d = malloc0(offsetof(JsonData, values) + sizeof(JsonVariant*)); if (!d) return log_oom(); @@ -1070,7 +1070,7 @@ static int output_json( _cleanup_free_ char *cursor = NULL; usec_t realtime, monotonic; JsonVariant **array = NULL; - struct json_data *d; + JsonData *d; uint64_t seqnum; size_t n = 0; int r;