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:
@@ -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 *,
|
||||
|
Reference in New Issue
Block a user