summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Esser <besser82@fedoraproject.org>2017-12-11 12:55:40 +0100
committerBjörn Esser <besser82@fedoraproject.org>2017-12-11 16:16:15 +0100
commitc123a1c21b944b3391fe022263ebfcdc15e5c5d1 (patch)
tree56198aa0f82f3645a7960af8b07a8b0141f2b889
parenta19031411ddcc3d9a0cc79bef8ab17efb33ea8fd (diff)
downloadjson-c-c123a1c21b944b3391fe022263ebfcdc15e5c5d1.tar.gz
json_object: Add size_t json_object_sizeof()
-rw-r--r--json_object.c5
-rw-r--r--json_object.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/json_object.c b/json_object.c
index 9daa6fd..f12d8f0 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 283eb95..6a2751d 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