diff --git a/src/jansson.h b/src/jansson.h index b980e8c..1371b59 100644 --- a/src/jansson.h +++ b/src/jansson.h @@ -50,6 +50,7 @@ typedef enum { typedef struct json_t { json_type type; size_t refcount; + boolean is_modified; } json_t; #ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ @@ -78,6 +79,7 @@ typedef long json_int_t; #define json_boolean_value json_is_true #define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) #define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL) +#define json_is_modified(json) ((json)->is_modified) /* construction, destruction, reference counting */ @@ -129,6 +131,8 @@ typedef struct { /* getters, setters, manipulation */ +int json_set_modified(json_t *json_object, bool input); + void json_object_seed(size_t seed); size_t json_object_size(const json_t *object); json_t *json_object_get(const json_t *object, const char *key); diff --git a/src/value.c b/src/value.c index 333d0af..afc4249 100644 --- a/src/value.c +++ b/src/value.c @@ -44,6 +44,11 @@ static JSON_INLINE void json_init(json_t *json, json_type type) } +int json_set_modified(json_t *json_object, bool input) +{ + json_object->is_modified = input; +} + /*** object ***/ extern volatile uint32_t hashtable_seed;