]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Fix code formatting
authorEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 29 Jun 2020 02:31:18 +0000 (02:31 +0000)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 29 Jun 2020 02:31:18 +0000 (02:31 +0000)
json_tokener.c
tests/test_parse.c

index 0d01d2b2a571af3e14083dd014499f78085d720f..63e02a147cf8ea89d180837c8d9a3e6abcf68196 100644 (file)
@@ -202,7 +202,7 @@ struct json_object *json_tokener_parse_verbose(const char *str, enum json_tokene
                 */
            || json_tokener_get_parse_end(tok) != strlen(str)
 #endif
-          )
+       )
 
        {
                if (obj != NULL)
@@ -874,13 +874,10 @@ struct json_object *json_tokener_parse_ex(struct json_tokener *tok, const char *
                                }
                        }
 
-                       while (c &&
-                           ((c >= '0' && c <= '9') ||
-                                (!is_exponent && (c=='e' || c=='E')) ||
-                                (neg_sign_ok && c=='-') ||
-                                (pos_sign_ok && c=='+') ||
-                                (!tok->is_double && c=='.')
-                        ))
+                       while (c && ((c >= '0' && c <= '9') ||
+                                    (!is_exponent && (c == 'e' || c == 'E')) ||
+                                    (neg_sign_ok && c == '-') || (pos_sign_ok && c == '+') ||
+                                    (!tok->is_double && c == '.')))
                        {
                                pos_sign_ok = neg_sign_ok = 0;
                                ++case_len;
@@ -922,10 +919,8 @@ struct json_object *json_tokener_parse_ex(struct json_tokener *tok, const char *
                            because c can be part of a new object to parse on the
                                next call to json_tokener_parse().
                         */
-                       if (tok->depth > 0 &&
-                           c != ',' && c != ']' && c != '}' && c != '/' &&
-                               c != 'I' && c != 'i' &&
-                           !isspace((unsigned char)c))
+                       if (tok->depth > 0 && c != ',' && c != ']' && c != '}' && c != '/' &&
+                           c != 'I' && c != 'i' && !isspace((unsigned char)c))
                        {
                                tok->err = json_tokener_error_parse_number;
                                goto out;
index d84b9d63bb9cf37f797f25533646f37652d7d385..5363f32867a81421c8cb89fa8ef4fb0bfe51b466 100644 (file)
@@ -371,7 +371,7 @@ struct incremental_step
     {"[0e-]", -1, -1, json_tokener_success, 1},
     {"[0e-]", -1, 4, json_tokener_error_parse_number, 1, JSON_TOKENER_STRICT},
 
-       /* You might expect this to fail, but it won't because
+    /* You might expect this to fail, but it won't because
           it's a valid partial parse; note the char_offset: */
     {"0e+-", 5, 3, json_tokener_success, 1},
     {"0e+-", 5, 3, json_tokener_error_parse_number, 1, JSON_TOKENER_STRICT},
@@ -453,7 +453,7 @@ struct incremental_step
     {"{\"a\":1}{\"b\":2}", 15, 7, json_tokener_success, 0},
     {&"{\"a\":1}{\"b\":2}"[7], 8, 7, json_tokener_success, 1},
 
-       /*
+    /*
         * Though this may seem invalid at first glance, it
         * parses as three separate numbers, 2015, -1 and -15
         * Of course, simply pasting together a stream of arbitrary