Inspired by MarcoFalke’s comment. 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.
Questions
- ~Was there actually any merit to
ParseNonRFCJSONValue()
surrounding the value with brackets and then parsing it as an array? I don’t see it, and the new approach doesn’t fail any tests. Still a bit suspicious about it though.~- Cleared up by #26506#pullrequestreview-1211984059
- If there are no objections to 7727603e44f8f674e0fc8389e78047e2b56e6052, I think we should follow up with a PR to rename
ParseNonRFCJSONValue()
to a localParse()
helper function (that throws if invalid), remove it fromclient.h
and merge the test coverage we currently have onParseNonRFCJSONValue()
with the coverage we have onUniValue::read()
.