richardphibel / rpms / systemd

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