diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-07-12 19:46:46 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-07-12 20:05:20 +0200 |
commit | a9e536a6bc1a401d454f22336ab9f1bdfde3d9ce (patch) | |
tree | 2cc5127463ddfe054c56c84b6b299574da9dbe08 /src/shared/logs-show.c | |
parent | json: free array in json_variant_unref_many() (diff) | |
download | systemd-a9e536a6bc1a401d454f22336ab9f1bdfde3d9ce.tar.xz systemd-a9e536a6bc1a401d454f22336ab9f1bdfde3d9ce.zip |
logs-show: Rename json_data to JsonData and add typedef
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r-- | src/shared/logs-show.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 1c5b212b01..7582dc9ace 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; |