Page MenuHomePhabricator

simplified IsHexNumber function
AbandonedPublic

Authored by majcosta on Mon, Nov 25, 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 OK
Unit
No Unit Test Coverage
Build Status
Buildable 8288
Build 14601: Bitcoin ABC Buildbot
Build 14600: arc lint + arc unit

Event Timeline

majcosta created this revision.Mon, Nov 25, 23:05
Owners added a reviewer: Restricted Owners Package.Mon, Nov 25, 23:05
Herald added a reviewer: Restricted Project. · View Herald TranscriptMon, Nov 25, 23:05
majcosta updated this revision to Diff 14413.Mon, Nov 25, 23:06

previous diff not clang-formatted properly. is now.

majcosta updated this revision to Diff 14416.Mon, Nov 25, 23:15

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.

majcosta abandoned this revision.Tue, Nov 26, 00:56