mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01: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:
committed by
Ryan Ofsky
parent
09416f9ec4
commit
df6e3756d6
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user