2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

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>
This commit is contained in:
Ben Pfaff
2018-03-23 15:46:58 -07:00
parent 056caea89b
commit 828129d927
4 changed files with 32 additions and 2 deletions

View File

@@ -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 *,