summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-03-07 21:44:45 +0100
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-03-07 21:44:45 +0100
commit00585c403abf45ac15b53176262aee4b05641f23 (patch)
tree2328362ca4c8a946e234ee247316b96adbb85bf9
parenta715292793538812e132405a18e2cbc947789403 (diff)
json.c: use VLA notation
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
-rw-r--r--include/json.h2
-rw-r--r--src/json.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/include/json.h b/include/json.h
index 5245115..9cc5bd1 100644
--- a/include/json.h
+++ b/include/json.h
@@ -46,7 +46,7 @@ enum json_parse_result {
};
struct json *json_parse(const char *str);
-struct json *json_parse_len(const char *str, size_t size);
+struct json *json_parse_len(size_t size, const char str[size]);
struct json *json_new(void);
diff --git a/src/json.c b/src/json.c
index 2e86eaf..cf71a90 100644
--- a/src/json.c
+++ b/src/json.c
@@ -143,7 +143,11 @@ enum json_parse_result parse_value(struct json **json_out, struct raw_json *raw,
return ret;
}
-struct json *json_parse_len(const char *str, size_t size) {
+struct json *json_parse(const char *str) {
+ return json_parse_len(strlen(str), str);
+}
+
+struct json *json_parse_len(size_t size, const char str[size]) {
if (!str || size == 0)
return NULL;
struct json *json = NULL;