mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
rpc: Avoid copies in JSONRPCReplyObj()
Change parameters from const references to values, so they can be moved into the reply instead of copied. Also update callers to move instead of copy.
This commit is contained in:
parent
09416f9ec4
commit
df6e3756d6
5 changed files with 16 additions and 23 deletions
|
|
@ -366,11 +366,11 @@ static UniValue JSONRPCExecOne(JSONRPCRequest jreq, const UniValue& req)
|
|||
jreq.parse(req);
|
||||
|
||||
UniValue result = tableRPC.execute(jreq);
|
||||
rpc_result = JSONRPCReplyObj(result, NullUniValue, jreq.id);
|
||||
rpc_result = JSONRPCReplyObj(std::move(result), NullUniValue, jreq.id);
|
||||
}
|
||||
catch (const UniValue& objError)
|
||||
catch (UniValue& e)
|
||||
{
|
||||
rpc_result = JSONRPCReplyObj(NullUniValue, objError, jreq.id);
|
||||
rpc_result = JSONRPCReplyObj(NullUniValue, std::move(e), jreq.id);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue