summaryrefslogtreecommitdiffstats
path: root/util/json.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-02 20:47:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-02 20:47:46 +0000
commit5b7ddc4bd2dcdde201ffa2681ede9a0a029bad96 (patch)
tree352b477f97c1c36105310589c7568259c76e9385 /util/json.h
parentAdding upstream version 1.12. (diff)
downloadnvme-cli-5b7ddc4bd2dcdde201ffa2681ede9a0a029bad96.tar.xz
nvme-cli-5b7ddc4bd2dcdde201ffa2681ede9a0a029bad96.zip
Adding upstream version 1.14.upstream/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) \