summaryrefslogtreecommitdiffstats
path: root/util/json.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-02 20:49:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-02 20:49:35 +0000
commitf2c543b4ccad3b9f8871d952cddf66b3b438595b (patch)
treec3c363d1cc72514221685c42a79a19b320114acc /util/json.h
parentAdding debian version 1.12-8. (diff)
downloadnvme-cli-f2c543b4ccad3b9f8871d952cddf66b3b438595b.tar.xz
nvme-cli-f2c543b4ccad3b9f8871d952cddf66b3b438595b.zip
Merging upstream version 1.14.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--util/json.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/util/json.h b/util/json.h
index d78d3db..666c78d 100644
--- a/util/json.h
+++ b/util/json.h
@@ -2,7 +2,6 @@
#define __JSON__H
struct json_object;
-struct json_array;
struct json_pair;
#define JSON_TYPE_STRING 0
@@ -21,22 +20,18 @@ struct json_value {
long double float_number;
char *string;
struct json_object *object;
- struct json_array *array;
+ struct json_object *array;
};
int parent_type;
union {
struct json_pair *parent_pair;
- struct json_array *parent_array;
+ struct json_object *parent_array;
};
};
-struct json_array {
+struct json_object {
struct json_value **values;
int value_cnt;
- struct json_value *parent;
-};
-
-struct json_object {
struct json_pair **pairs;
int pair_cnt;
struct json_value *parent;
@@ -49,10 +44,10 @@ struct json_pair {
};
struct json_object *json_create_object(void);
-struct json_array *json_create_array(void);
+struct json_object *json_create_array(void);
void json_free_object(struct json_object *obj);
-void json_free_array(struct json_array *array);
+void json_free_array(struct json_object *array);
int json_object_add_value_type(struct json_object *obj, const char *name, int type, ...);
#define json_object_add_value_int(obj, name, val) \
@@ -67,7 +62,7 @@ int json_object_add_value_type(struct json_object *obj, const char *name, int ty
json_object_add_value_type((obj), name, JSON_TYPE_OBJECT, (val))
#define json_object_add_value_array(obj, name, val) \
json_object_add_value_type((obj), name, JSON_TYPE_ARRAY, (val))
-int json_array_add_value_type(struct json_array *array, int type, ...);
+int json_array_add_value_type(struct json_object *array, int type, ...);
#define json_array_add_value_int(obj, val) \
json_array_add_value_type((obj), JSON_TYPE_INTEGER, (val))
#define json_array_add_value_uint(obj, val) \