Skip to content

common/strtol: fix strict_strtoll() so it accepts hex starting with 0x - #21521

Merged
tchaikov merged 1 commit into
ceph:masterfrom
tchaikov:wip-stoll
Apr 21, 2018
Merged

tchaikov merged 1 commit into
ceph:masterfrom
tchaikov:wip-stoll

Conversation

@tchaikov

Copy link
Copy Markdown
Contributor
  • simplify the error handling of strtoll().
  • only instantiate ostringstream when handling errors.

Signed-off-by: Kefu Chai [email protected]

@jan--f jan--f left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @tchaikov looks good. It would be nice to use std::from_chars once its available in the stdlib.

Comment thread src/common/strtol.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::string(str) also works

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ukernel sure, updated and repushed

@tchaikov
tchaikov force-pushed the wip-stoll branch 2 times, most recently from e763ac3 to 8359d16 Compare April 19, 2018 14:37
- simplify the error handling of strtoll().
- only instantiate ostringstream when handling errors.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
tchaikov merged commit 717b941 into ceph:master Apr 21, 2018
@tchaikov
tchaikov deleted the wip-stoll branch April 21, 2018 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants