Message ID | 20210924101744.30065-1-anton.ivanov@cambridgegreys.com |
---|---|
State | Deferred |
Headers | show |
Series | [ovs-dev,v2] jsonrpc: Sort JSON objects only if debug is on | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index c8ce5362e..18777f4d6 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -802,7 +802,15 @@ jsonrpc_msg_to_string(const struct jsonrpc_msg *m) { struct jsonrpc_msg *copy = jsonrpc_msg_clone(m); struct json *json = jsonrpc_msg_to_json(copy); - char *s = json_to_string(json, JSSF_SORT); + char *s; + if (VLOG_IS_DBG_ENABLED()) { + /* We need json sorted only if a human is looking + * at it. No point to sort it if debug is not on. + */ + s = json_to_string(json, JSSF_SORT); + } else { + s = json_to_string(json, 0); + } json_destroy(json); return s; }