]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
json_object: Add size_t json_object_sizeof() 388/head
authorBjörn Esser <besser82@fedoraproject.org>
Mon, 11 Dec 2017 11:55:40 +0000 (12:55 +0100)
committerBjörn Esser <besser82@fedoraproject.org>
Mon, 11 Dec 2017 15:16:15 +0000 (16:16 +0100)
json_object.c
json_object.h

index 9daa6fdb0a5478b5bbf434d555b2c3cc01e76686..f12d8f08d8ab3f041381d19a628c19af0ac6d25f 100644 (file)
@@ -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)
 {
index 283eb953008a4922d82d0f14d588cd5e56897996..6a2751d228b96828e8279a729a2081a6c80a8074 100644 (file)
@@ -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