diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-23 22:12:28 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-27 11:46:25 +0200 |
| commit | 086cb73ef88a4962345b8284e47cea52da428135 (patch) | |
| tree | fceb159be84afd98e68494c69208226ecf240f7c /src | |
| parent | 37516080db6878bef6fb1e6c5542165f3f982792 (diff) | |
json keys typing & removed simple t_assert
Diffstat (limited to 'src')
| -rw-r--r-- | src/json.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -14,7 +14,7 @@ JSONObject *JSONObject_new(Arena *a) { JSONObject *object = new(a, JSONObject, 1); object->len = 0; - object->keys = Vec_new(a, Str, 2); + object->keys = Vec_new(a, StrView, 2); object->values = Vec_new(a, JSON, 2); return object; } @@ -96,9 +96,9 @@ i32 JSON_fprint(FILE *w, JSON json) { case JSON_OBJECT: fprintf(w, "{"); for (size i = 0; i < json.as.object.len; i++) { - Str key = *Vec_get(json.as.object.keys, Str, i); + StrView key = *Vec_get(json.as.object.keys, StrView, i); fprintf(w, "\""); - Str_fprint(w, key); + StrView_fprint(w, key); fprintf(w, "\": "); JSON value = *Vec_get(json.as.object.values, JSON, i); JSON_fprint(w, value); @@ -217,7 +217,7 @@ parse_result parse_object(Arena *a, byte *src, uptr start_pos, uptr max_pos) { parse_result result = {0}; result.pos = absorb_whitespaces(src, start_pos + 1, max_pos); size len = 0; - Vec keys = Vec_new(a, Str, 6); + Vec keys = Vec_new(a, StrView, 6); Vec values = Vec_new(a, JSON, 6); if (src[result.pos] == '}') { result.pos++; |
