summaryrefslogtreecommitdiff
path: root/json_object_private.h
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2020-05-25 03:14:06 +0000
committerEric Haszlakiewicz <erh+git@nimenees.com>2020-05-25 03:18:36 +0000
commit853b4b5dee4ca26a58f0b71944fa725c4a45ff0a (patch)
treef631f90f4517cc2fe8f94d0f606381fb276bb5cc /json_object_private.h
parent4a546e7b2f471157c6f479df1ef687864fcbd89e (diff)
downloadjson-c-853b4b5dee4ca26a58f0b71944fa725c4a45ff0a.tar.gz
Start splitting struct json_object into multiple sub-types, as descibed at https://github.com/json-c/json-c/wiki/Proposal:-struct-json_object-split
The current changes split out _only_ json_type_object, and thus have a number of hacks to allow the code to continue to build and work. Originally mentioned in issue #535. When complete, this will probably invalidate #552. This is likely to cause notable conflicts in any other significant un-merged changes, such as PR#620.
Diffstat (limited to 'json_object_private.h')
-rw-r--r--json_object_private.h53
1 files changed, 52 insertions, 1 deletions
diff --git a/json_object_private.h b/json_object_private.h
index 1c7737a..b6dfe0d 100644
--- a/json_object_private.h
+++ b/json_object_private.h
@@ -36,8 +36,60 @@ typedef enum json_object_int_type
json_object_int_type_uint64
} json_object_int_type;
+struct json_object_base // XAX rename to json_object after conversion
+{
+ int newold; // XAX temporary, remove after code conversion
+ enum json_type o_type;
+ uint32_t _ref_count;
+ json_object_private_delete_fn *_delete;
+ json_object_to_json_string_fn *_to_json_string;
+ struct printbuf *_pb;
+ json_object_delete_fn *_user_delete;
+ void *_userdata;
+ char data[1]; // Actually a struct json_object_${o_type}
+};
+
+struct json_object_object
+{
+ struct json_object_base base;
+ struct lh_table *c_object;
+};
+struct json_object_array
+{
+ struct json_object_base base;
+ struct array_list *c_array;
+};
+
+struct json_object_boolean
+{
+ struct json_object_base base;
+ json_bool c_boolean;
+};
+struct json_object_double
+{
+ struct json_object_base base;
+ json_bool c_double;
+};
+struct json_object_int
+{
+ struct json_object_base base;
+ enum json_object_int_type cint_type;
+ union
+ {
+ int64_t c_int64;
+ uint64_t c_uint64;
+ } cint;
+};
+struct json_object_string
+{
+ struct json_object_base base;
+ size_t len;
+ char data[1]; // Actually longer
+};
+
struct json_object
{
+ int newold;
enum json_type o_type;
uint32_t _ref_count;
json_object_private_delete_fn *_delete;
@@ -56,7 +108,6 @@ struct json_object
} cint;
enum json_object_int_type cint_type;
} c_int;
- struct lh_table *c_object;
struct array_list *c_array;
struct
{