HomePhabricator

refactor: RPC: pass named argument value as string_view

Description

refactor: RPC: pass named argument value as string_view

Summary:

Main purpose of this PR is to minimize copying (potentially large) RPC named arguments when calling .substr() by using std::string_view instead of std::string. Furthermore, cleans up the code by removing unnecessary complexity in ParseNonRFCJSONValue() (done first to avoid refactoring required to concatenate string and string_view), updates some naming and adds a few test cases. Should not introduce any behaviour change.

Backport of core#26612.

Depends on D16290 and D16291.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D16293

Details

Provenance
FabienAuthored on Jun 5 2024, 20:33
FabienPushed on Jun 6 2024, 09:26
Reviewer
Restricted Project
Differential Revision
D16293: refactor: RPC: pass named argument value as string_view
Parents
rABCd57a68a1ce19: refactor: use convenience fn to auto parse non-string parameters
Branches
Unknown
Tags
Unknown