mirror of
https://github.com/json-c/json-c.git
synced 2026-04-11 00:09:06 +08:00
Merge pull request #390 from besser82/json-c-0.13
json_object: Add const size_t json_c_object_sizeof()
This commit is contained in:
@@ -509,6 +509,11 @@ int json_object_object_length(const struct json_object *jso)
|
|||||||
return lh_table_length(jso->o.c_object);
|
return lh_table_length(jso->o.c_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t json_c_object_sizeof(void)
|
||||||
|
{
|
||||||
|
return sizeof(struct json_object);
|
||||||
|
}
|
||||||
|
|
||||||
struct json_object* json_object_object_get(const struct json_object* jso,
|
struct json_object* json_object_object_get(const struct json_object* jso,
|
||||||
const char *key)
|
const char *key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,12 @@
|
|||||||
#define THIS_FUNCTION_IS_DEPRECATED(func) func
|
#define THIS_FUNCTION_IS_DEPRECATED(func) func
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define JSON_C_CONST_FUNCTION(func) func __attribute__((const))
|
||||||
|
#else
|
||||||
|
#define CONST_FUNCTION(func) func
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define JSON_EXPORT __declspec(dllexport)
|
#define JSON_EXPORT __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
@@ -392,6 +398,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);
|
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_C_CONST_FUNCTION(JSON_EXPORT size_t json_c_object_sizeof(void));
|
||||||
|
|
||||||
/** Add an object field to a json_object of type json_type_object
|
/** 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
|
* The reference count will *not* be incremented. This is to make adding
|
||||||
|
|||||||
Reference in New Issue
Block a user