src/cx/json.h

changeset 996
333155f234c4
parent 988
15b3ca7ee33f
--- a/src/cx/json.h	Thu Nov 28 19:37:00 2024 +0100
+++ b/src/cx/json.h	Thu Nov 28 20:53:56 2024 +0100
@@ -37,6 +37,7 @@
 #define UCX_JSON_H
 
 #include "common.h"
+#include "allocator.h"
 #include "string.h"
 #include "array_list.h"
 
@@ -113,6 +114,7 @@
 };
 
 struct cx_json_s {
+    const CxAllocator *allocator;
     const char *buffer;
     size_t size;
     size_t pos;
@@ -160,6 +162,7 @@
 };
 
 struct cx_json_value_s {
+    const CxAllocator *allocator;
     CxJsonValueType type;
     union {
         CxJsonArray array;
@@ -171,10 +174,9 @@
     } value;
 };
 
-// TODO: add support for CxAllocator
 
-cx_attr_nonnull
-void cxJsonInit(CxJson *json);
+cx_attr_nonnull_arg(2)
+void cxJsonInit(const CxAllocator *allocator, CxJson *json);
 
 cx_attr_nonnull
 void cxJsonDestroy(CxJson *json);

mercurial