ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
8d419f
From eb01fd30cb625e90d5620b3ca31ca6474e1b0ac0 Mon Sep 17 00:00:00 2001
8d419f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
8d419f
Date: Mon, 9 May 2022 13:37:35 +0200
8d419f
Subject: [PATCH] shared/json: wrap long comments
8d419f
8d419f
(cherry picked from commit bac06497feda9eb8c485243f2e05a7f7c112616c)
8d419f
Related: #2087652
8d419f
---
8d419f
 src/shared/json.c | 35 +++++++++++++++++------------------
8d419f
 1 file changed, 17 insertions(+), 18 deletions(-)
8d419f
8d419f
diff --git a/src/shared/json.c b/src/shared/json.c
8d419f
index d35874f8e3..ea1291e21b 100644
8d419f
--- a/src/shared/json.c
8d419f
+++ b/src/shared/json.c
8d419f
@@ -273,8 +273,8 @@ static JsonVariant *json_variant_formalize(JsonVariant *v) {
8d419f
 
8d419f
 static JsonVariant *json_variant_conservative_formalize(JsonVariant *v) {
8d419f
 
8d419f
-        /* Much like json_variant_formalize(), but won't simplify if the variant has a source/line location attached to
8d419f
-         * it, in order not to lose context */
8d419f
+        /* Much like json_variant_formalize(), but won't simplify if the variant has a source/line location
8d419f
+         * attached to it, in order not to lose context */
8d419f
 
8d419f
         if (!v)
8d419f
                 return NULL;
8d419f
@@ -546,7 +546,7 @@ int json_variant_new_array(JsonVariant **ret, JsonVariant **array, size_t n) {
8d419f
 
8d419f
         for (v->n_elements = 0; v->n_elements < n; v->n_elements++) {
8d419f
                 JsonVariant *w = v + 1 + v->n_elements,
8d419f
-                        *c = array[v->n_elements];
8d419f
+                            *c = array[v->n_elements];
8d419f
                 uint16_t d;
8d419f
 
8d419f
                 d = json_variant_depth(c);
8d419f
@@ -690,7 +690,7 @@ int json_variant_new_object(JsonVariant **ret, JsonVariant **array, size_t n) {
8d419f
 
8d419f
         for (v->n_elements = 0; v->n_elements < n; v->n_elements++) {
8d419f
                 JsonVariant *w = v + 1 + v->n_elements,
8d419f
-                        *c = array[v->n_elements];
8d419f
+                            *c = array[v->n_elements];
8d419f
                 uint16_t d;
8d419f
 
8d419f
                 if ((v->n_elements & 1) == 0) {
8d419f
@@ -731,7 +731,6 @@ int json_variant_new_object(JsonVariant **ret, JsonVariant **array, size_t n) {
8d419f
 }
8d419f
 
8d419f
 static size_t json_variant_size(JsonVariant* v) {
8d419f
-
8d419f
         if (!json_variant_is_regular(v))
8d419f
                 return 0;
8d419f
 
8d419f
@@ -2253,8 +2252,9 @@ static int json_variant_set_source(JsonVariant **v, JsonSource *source, unsigned
8d419f
 
8d419f
         assert(v);
8d419f
 
8d419f
-        /* Patch in source and line/column number. Tries to do this in-place if the caller is the sole referencer of
8d419f
-         * the object. If not, allocates a new object, possibly a surrogate for the original one */
8d419f
+        /* Patch in source and line/column number. Tries to do this in-place if the caller is the sole
8d419f
+         * referencer of the object. If not, allocates a new object, possibly a surrogate for the original
8d419f
+         * one */
8d419f
 
8d419f
         if (!*v)
8d419f
                 return 0;
8d419f
@@ -3731,10 +3731,10 @@ int json_buildv(JsonVariant **ret, va_list ap) {
8d419f
 
8d419f
                         stack[n_stack++] = (JsonStack) {
8d419f
                                 .expect = EXPECT_OBJECT_KEY,
8d419f
-                                .n_suppress = current->n_suppress != 0 ? SIZE_MAX : 0, /* if we shall suppress the
8d419f
-                                                                                           * new object, then we should
8d419f
-                                                                                           * also suppress all object
8d419f
-                                                                                           * members */
8d419f
+                                .n_suppress = current->n_suppress != 0 ? SIZE_MAX : 0, /* If we shall suppress the
8d419f
+                                                                                        * new object, then we should
8d419f
+                                                                                        * also suppress all object
8d419f
+                                                                                        * members. */
8d419f
                         };
8d419f
 
8d419f
                         break;
8d419f
@@ -4102,9 +4102,9 @@ int json_buildv(JsonVariant **ret, va_list ap) {
8d419f
                                 current->elements[current->n_elements++] = TAKE_PTR(add_more);
8d419f
                 }
8d419f
 
8d419f
-                /* If we are supposed to suppress items, let's subtract how many items where generated from that
8d419f
-                 * counter. Except if the counter is SIZE_MAX, i.e. we shall suppress an infinite number of elements
8d419f
-                 * on this stack level */
8d419f
+                /* If we are supposed to suppress items, let's subtract how many items where generated from
8d419f
+                 * that counter. Except if the counter is SIZE_MAX, i.e. we shall suppress an infinite number
8d419f
+                 * of elements on this stack level */
8d419f
                 if (current->n_suppress != SIZE_MAX) {
8d419f
                         if (current->n_suppress <= n_subtract) /* Saturated */
8d419f
                                 current->n_suppress = 0;
8d419f
@@ -4696,10 +4696,9 @@ finish:
8d419f
 }
8d419f
 
8d419f
 bool json_variant_is_normalized(JsonVariant *v) {
8d419f
-
8d419f
-        /* For now, let's consider anything containing numbers not expressible as integers as
8d419f
-         * non-normalized. That's because we cannot sensibly compare them due to accuracy issues, nor even
8d419f
-         * store them if they are too large. */
8d419f
+        /* For now, let's consider anything containing numbers not expressible as integers as non-normalized.
8d419f
+         * That's because we cannot sensibly compare them due to accuracy issues, nor even store them if they
8d419f
+         * are too large. */
8d419f
         if (json_variant_is_real(v) && !json_variant_is_integer(v) && !json_variant_is_unsigned(v))
8d419f
                 return false;
8d419f