aboutsummaryrefslogtreecommitdiff
path: root/json.c
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-07-23 15:02:47 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-07-23 15:02:47 +0200
commit2850fd0e8389a95acf12b8f66042b955cabf2d50 (patch)
treedb759b7f050b5ef6c670f887ca3b6568ef58bdfd /json.c
parent2d3b907128e00b1384484c0bd96591db3f4c3c90 (diff)
chore: Format short if line
Diffstat (limited to 'json.c')
-rw-r--r--json.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/json.c b/json.c
index e189032..b02c413 100644
--- a/json.c
+++ b/json.c
@@ -89,8 +89,7 @@ i32 JSON_fprint(FILE *w, JSON json) {
for (size i = 0; i < json.as.array.len; i++) {
JSON value = *Vec_get(json.as.array, JSON, i);
JSON_fprint(w, value);
- if (i < json.as.array.len - 1)
- fprintf(w, ", ");
+ if (i < json.as.array.len - 1) fprintf(w, ", ");
}
fprintf(w, "]");
return 0;
@@ -103,8 +102,7 @@ i32 JSON_fprint(FILE *w, JSON json) {
fprintf(w, "\": ");
JSON value = *Vec_get(json.as.object.values, JSON, i);
JSON_fprint(w, value);
- if (i < json.as.object.len - 1)
- fprintf(w, ", ");
+ if (i < json.as.object.len - 1) fprintf(w, ", ");
}
fprintf(w, "}");
return 0;
@@ -230,14 +228,10 @@ parse_result parse_object(Arena *a, byte *src, uptr start_pos) {
parse_result parse_any(Arena *a, byte *src, uptr pos) {
pos = absorb_whitespaces(src, pos);
- if (isdigit(src[pos]))
- return parse_number(src, pos);
- if (src[pos] == '[')
- return parse_array(a, src, pos);
- if (src[pos] == '"')
- return parse_string(a, src, pos);
- if (src[pos] == '{')
- return parse_object(a, src, pos);
+ if (isdigit(src[pos])) return parse_number(src, pos);
+ if (src[pos] == '[') return parse_array(a, src, pos);
+ if (src[pos] == '"') return parse_string(a, src, pos);
+ if (src[pos] == '{') return parse_object(a, src, pos);
if (memcmp(src + pos, "true", 4) == 0) {
parse_result result = {0};
result.value = JSON_boolean(true);