From: Björn Esser Date: Mon, 11 Dec 2017 11:55:40 +0000 (+0100) Subject: json_object: Add size_t json_object_sizeof() X-Git-Tag: json-c-0.14-20200419~143^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F388%2Fhead;p=thirdparty%2Fjson-c.git json_object: Add size_t json_object_sizeof() --- diff --git a/json_object.c b/json_object.c index 9daa6fdb..f12d8f08 100644 --- a/json_object.c +++ b/json_object.c @@ -509,6 +509,11 @@ int json_object_object_length(const struct json_object *jso) return lh_table_length(jso->o.c_object); } +size_t json_object_sizeof(void) +{ + return sizeof(struct json_object); +} + struct json_object* json_object_object_get(const struct json_object* jso, const char *key) { diff --git a/json_object.h b/json_object.h index 283eb953..6a2751d2 100644 --- a/json_object.h +++ b/json_object.h @@ -392,6 +392,11 @@ JSON_EXPORT struct lh_table* json_object_get_object(const struct json_object *ob */ JSON_EXPORT int json_object_object_length(const struct json_object* obj); +/** Get the sizeof (struct json_object). + * @returns a size_t with the sizeof (struct json_object) + */ +JSON_EXPORT size_t json_object_sizeof(void); + /** Add an object field to a json_object of type json_type_object * * The reference count will *not* be incremented. This is to make adding