aboutsummaryrefslogtreecommitdiff
path: root/src/jansson_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/jansson_private.h')
-rw-r--r--src/jansson_private.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/jansson_private.h b/src/jansson_private.h
index c6f437c..9d886f6 100644
--- a/src/jansson_private.h
+++ b/src/jansson_private.h
@@ -59,14 +59,26 @@ typedef struct {
typedef struct {
json_t json;
+ json_bigr_t value;
+} json_bigreal_t;
+
+typedef struct {
+ json_t json;
json_int_t value;
} json_integer_t;
+typedef struct {
+ json_t json;
+ json_bigz_t value;
+} json_biginteger_t;
+
#define json_to_object(json_) container_of(json_, json_object_t, json)
#define json_to_array(json_) container_of(json_, json_array_t, json)
#define json_to_string(json_) container_of(json_, json_string_t, json)
#define json_to_real(json_) container_of(json_, json_real_t, json)
#define json_to_integer(json_) container_of(json_, json_integer_t, json)
+#define json_to_biginteger(json_) container_of(json_, json_biginteger_t, json)
+#define json_to_bigreal(json_) container_of(json_, json_bigreal_t, json)
/* Create a string by taking ownership of an existing buffer */
json_t *jsonp_stringn_nocheck_own(const char *value, size_t len);
@@ -83,12 +95,27 @@ void jsonp_error_vset(json_error_t *error, int line, int column,
int jsonp_strtod(strbuffer_t *strbuffer, double *out);
int jsonp_dtostr(char *buffer, size_t size, double value);
+/* For estimating precision needed to store a real number */
+int jsonp_count_significand_digits(strbuffer_t *strbuffer);
+
+/* Global context */
+
+typedef struct json_context {
+ json_memory_funcs_t memfuncs;
+ int have_bigint;
+ int have_bigreal;
+ json_bigint_funcs_t bigint;
+ json_bigreal_funcs_t bigreal;
+} json_context_t;
+
+json_context_t *jsonp_context(void);
+
/* Wrappers for custom memory functions */
-void* jsonp_malloc(size_t size);
+void *jsonp_malloc(size_t size);
void jsonp_free(void *ptr);
-char *jsonp_strndup(const char *str, size_t length);
char *jsonp_strdup(const char *str);
char *jsonp_strndup(const char *str, size_t len);
+void jsonp_overwrite(void *ptr, size_t size);
/* Windows compatibility */
#ifdef _WIN32