summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Zhou <azhou@nicira.com>2015-08-11 14:14:59 -0700
committerAndy Zhou <azhou@nicira.com>2015-09-01 15:17:48 -0700
commit2db02185fee07032d4fb2d4c337153e2828a4fa8 (patch)
tree78dd4ea2485f2187850a91ac1cc56877016ae6ce
parent71cc59f928f1fae64645540463da41f3c44f761a (diff)
downloadopenvswitch-2db02185fee07032d4fb2d4c337153e2828a4fa8.tar.gz
lib/jsonrpc: make use of ofpbuf_use_ds()
Make use of ofpbuf_use_ds() to simplify code. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--lib/jsonrpc.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
index b48e24751..e6ee195c7 100644
--- a/lib/jsonrpc.c
+++ b/lib/jsonrpc.c
@@ -240,7 +240,6 @@ jsonrpc_send(struct jsonrpc *rpc, struct jsonrpc_msg *msg)
struct json *json;
struct ds ds = DS_EMPTY_INITIALIZER;
size_t length;
- char *s;
if (rpc->status) {
jsonrpc_msg_destroy(msg);
@@ -252,12 +251,10 @@ jsonrpc_send(struct jsonrpc *rpc, struct jsonrpc_msg *msg)
json = jsonrpc_msg_to_json(msg);
json_to_ds(json, 0, &ds);
length = ds.length;
- s = ds_steal_cstr(&ds);
json_destroy(json);
buf = xmalloc(sizeof *buf);
- ofpbuf_use(buf, s, length);
- buf->size = length;
+ ofpbuf_use_ds(buf, &ds);
list_push_back(&rpc->output, &buf->list_node);
rpc->output_count++;
rpc->backlog += length;