diff options
author | Ben Pfaff <blp@ovn.org> | 2018-03-23 15:46:58 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-03-31 12:22:58 -0700 |
commit | 828129d9271da18c2742648aa910e1fe399bb8db (patch) | |
tree | b6c38580b22179dc7c7efd4c030aed5b9ff89b38 /include/openvswitch/json.h | |
parent | 056caea89bffe5f27000944c0ed5aaa6f7a2d852 (diff) | |
download | openvswitch-828129d9271da18c2742648aa910e1fe399bb8db.tar.gz |
json: Avoid extra memory allocation and string copy parsing object members.
Until now, every time the JSON parser added an object member, it made an
extra copy of the member name and then freed the original copy. This is
wasteful, so this commit eliminates the extra copy.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Diffstat (limited to 'include/openvswitch/json.h')
-rw-r--r-- | include/openvswitch/json.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/openvswitch/json.h b/include/openvswitch/json.h index 61b9a02cf..bcf6a2782 100644 --- a/include/openvswitch/json.h +++ b/include/openvswitch/json.h @@ -91,6 +91,7 @@ struct json *json_array_create_3(struct json *, struct json *, struct json *); struct json *json_object_create(void); void json_object_put(struct json *, const char *name, struct json *value); +void json_object_put_nocopy(struct json *, char *name, struct json *value); void json_object_put_string(struct json *, const char *name, const char *value); void json_object_put_format(struct json *, |