Page MenuHomePhabricator

Merge #12159: Use the character based overload for std::string::find.
Needs RevisionPublic

Authored by nakihito on Thu, Jul 25, 22:49.

Details

Reviewers
deadalnix
Fabien
jasonbcox
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Summary

a73aab7 Use the character based overload for std::string::find. (Alin Rus)

Pull request description:

std::string::find has a character based overload as can be seen here
(4th oveload): http://www.cplusplus.com/reference/string/string/find/

Use that instead of constantly allocating temporary strings.

Tree-SHA512: dc7684b1551e6d779eb989e9a74363f9b978059a7c0f3db09d01744c7e6452961f9e671173265e71efff27afbcb80c0fe2c11b6dff2290e54a49193fa25a5679

Backport of Core PR12159
https://github.com/bitcoin/bitcoin/pull/12159/

Test Plan
make check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR12159
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 6976
Build 11999: Bitcoin ABC Teamcity Staging
Build 11998: arc lint + arc unit

Event Timeline

nakihito created this revision.Thu, Jul 25, 22:49
Owners added a reviewer: Restricted Owners Package.Thu, Jul 25, 22:49
Herald added a reviewer: Restricted Project. · View Herald TranscriptThu, Jul 25, 22:49
deadalnix requested changes to this revision.Thu, Jul 25, 23:43

There are 2 more instances in the codebase.

This revision now requires changes to proceed.Thu, Jul 25, 23:43

There are 2 more instances in the codebase.

Could you point them out to me? The only other instance of std::string::find() I found was wallet.h line 619 size_t nSepPos = strComment.find("\0", 0, 1); and changing "\0" to '\0' does not compile.