json_object_private: remove _delete field

This field is set based on o_type when the object is created and it is
not changed during the lifetime of the object. Therefore we can check
o_type to choose the proper delete function in json_object_put(), and
save sizeof(void *) bytes in struct json_object_private.
This commit is contained in:
Ramiro Polla
2018-12-01 18:57:22 +01:00
parent 39c9fa0a2b
commit 1f46d2f40f
2 changed files with 16 additions and 10 deletions

View File

@@ -22,13 +22,10 @@ extern "C" {
#define LEN_DIRECT_STRING_DATA 32 /**< how many bytes are directly stored in json_object for strings? */
typedef void (json_object_private_delete_fn)(struct json_object *o);
struct json_object
{
enum json_type o_type;
uint32_t _ref_count;
json_object_private_delete_fn *_delete;
json_object_to_json_string_fn *_to_json_string;
struct printbuf *_pb;
union data {