Replace base10 users of StringUtil::atoull with absl::SimpleAtoi#6697
Merged
lizan merged 6 commits intoenvoyproxy:masterfrom Apr 25, 2019
Merged
Replace base10 users of StringUtil::atoull with absl::SimpleAtoi#6697lizan merged 6 commits intoenvoyproxy:masterfrom
lizan merged 6 commits intoenvoyproxy:masterfrom
Conversation
absl::SimpleAtoi takes absl::string_view argument and can easily replace all of the calls to StringUtil::atoull that are using Base 10 conversion. This eliminates a significant number of places where a std::string needed to be constructed from string_view to obtain a C string for StringUtil:atoull. Signed-off-by: Dan Noé <dpn@google.com>
Signed-off-by: Dan Noé <dpn@google.com>
Signed-off-by: Dan Noé <dpn@google.com>
lizan
reviewed
Apr 24, 2019
| * | ||
| * @param return true if successful, false otherwise. | ||
| */ | ||
| static bool atoull(const char* str, uint64_t& out, int base = 10); |
Member
There was a problem hiding this comment.
Where is the remaining use cases of this method?
Contributor
Author
There was a problem hiding this comment.
They are all hex conversions. I haven't dug around for the best option yet to replace them, but I plan to do that next as part of ongoing #6580 work.
I am also planning to eliminate StringUtil::atoll since every existing use case of it is base 10 and can just be replaced with absl::SimpleAtoi.
Signed-off-by: Dan Noé <dpn@google.com>
lizan
previously approved these changes
Apr 24, 2019
Member
|
/retest |
|
🔨 rebuilding |
Contributor
Author
|
asan looks like a real issue, fixing. |
Contributor
Author
|
/retest |
|
🔨 rebuilding |
lizan
approved these changes
Apr 25, 2019
| .inc(); | ||
| uint64_t grpc_status_code; | ||
| const std::string grpc_status_string(grpc_status->value().getStringView()); | ||
| // TODO(dnoe): Migrate to pure string_view (#6580) |
Member
There was a problem hiding this comment.
@dnoe I think this can be removed now? Can you merge into one of your follow ups?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
absl::SimpleAtoitakesabsl::string_viewargument and can easily replace all of the calls toStringUtil::atoullthat are using Base 10 conversion. This eliminates a significant number of places where astd::stringneeded to be constructed fromstring_viewto obtain a C string forStringUtil:atoull.Risk Level: Low
Testing:
bazel test //test/...Docs Changes: N/A
Release Notes: N/A
Part of: Issue #6580
Signed-off-by: Dan Noé dpn@google.com