Page MenuHomePhabricator

simplified IsHexNumber function
AbandonedPublic

Authored by majcosta on Nov 25 2019, 23:05.

Details

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

removed use of pointer to iterators, spurious function calls and made the function noexcept

Test Plan

wrote a local cpp test testing many possible hex strings including the "" and "0x" edge cases to make sure function behaves appropriately.

also forced substr to throw out_of_range - substr(-1,x) - and made sure it is caught so the 'noexcept' isn't a lie

Diff Detail

Repository
rABC Bitcoin ABC
Branch
refactor-util-strencodings
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8288
Build 14601: Default Diff Build & Tests
Build 14600: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Nov 25 2019, 23:05

previous diff not clang-formatted properly. is now.

changed function declaration to noexcept

While the change isn't bad per se, this is actually not helping. This code is maintained today by the Core developers and taking ownership of it just increase our maintenance burden. Without a direct benefit, this is hard to justify.

src/util/strencodings.cpp
73

As an aside, this may allocate memory - though most stdlib will do SSO in practice for 2 chars. Allocating when you can avoid is usually a pretty bad idea.

I understand. Gonna look for something more useful then. Closing.