diff options
author | Ben Pfaff <blp@nicira.com> | 2010-01-22 14:57:18 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-01-26 09:49:30 -0800 |
commit | 36d802ae1fd61d5ae3bfa1b114b8f3a911d987e5 (patch) | |
tree | 07cb96b35ed403aafef96934a797792456323cd6 /lib/jsonrpc.c | |
parent | 7d23a63aa4bc4479bf85b739e5be80ab12c5fc1b (diff) |
json: New function json_to_ds().
Some upcoming code wants to serialize JSON into a "struct ds" dynamic
string buffer, so expose an interface to do this.
This commit doesn't change much, but it renames some functions internal
to json.c to make the naming more consistent.
Also, make jsonrpc_log_msg() use this new function, since it is a more
straightforward way to do what it wants.
Diffstat (limited to 'lib/jsonrpc.c')
-rw-r--r-- | lib/jsonrpc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 562a2870..5c7dfca9 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -152,19 +152,19 @@ jsonrpc_log_msg(const struct jsonrpc *rpc, const char *title, } if (msg->params) { ds_put_cstr(&s, ", params="); - ds_put_and_free_cstr(&s, json_to_string(msg->params, 0)); + json_to_ds(msg->params, 0, &s); } if (msg->result) { ds_put_cstr(&s, ", result="); - ds_put_and_free_cstr(&s, json_to_string(msg->result, 0)); + json_to_ds(msg->result, 0, &s); } if (msg->error) { ds_put_cstr(&s, ", error="); - ds_put_and_free_cstr(&s, json_to_string(msg->error, 0)); + json_to_ds(msg->error, 0, &s); } if (msg->id) { ds_put_cstr(&s, ", id="); - ds_put_and_free_cstr(&s, json_to_string(msg->id, 0)); + json_to_ds(msg->id, 0, &s); } VLOG_DBG("%s: %s %s%s", rpc->name, title, jsonrpc_msg_type_to_string(msg->type), ds_cstr(&s)); |