]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logs-show: Rename json_data to JsonData and add typedef 28365/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 12 Jul 2023 17:46:46 +0000 (19:46 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 12 Jul 2023 18:05:20 +0000 (20:05 +0200)
src/shared/logs-show.c

index 1c5b212b01e7fb5d641fb8402287dd84136ea99b..7582dc9ace49c7f900676c792bb57e3d12baa273 100644 (file)
@@ -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;