Add strtonumx(), a companion to strtonum(3) that preserves its safety
and error-reporting semantics while allowing the caller to specify a
conversion base, similar to the strtol(3) family of functions.
Details
- Reviewers
kib des emaste - Commits
- rG6a6f230d3143: libc/stdlib: Port strtonumx() from Illumos
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
This looks fine to me, but I prefer to have more eyes on it before is is engraved into the libc.
| lib/libc/stdlib/strtonum.3 | ||
|---|---|---|
| 194 | illumos doesn't have versions or version numbers. If it helps I can try to find the exact date the commit went into illumos-gate. | |
| lib/libc/stdlib/strtonum.c | ||
| 5 | It's the copyright of the original change, not mine. I'm not sure it would be well received by them if I changed it here? | |
| lib/libc/stdlib/strtonum.c | ||
|---|---|---|
| 5 | I don't know either, so I asked them. Hopefully they will come comment. It's so small, but I wanna get this kinda stuff right during import. | |
| lib/libc/stdlib/strtonum.c | ||
|---|---|---|
| 5 | It's not necessary and if it's not in upstream; let's omit it. It's kind of silly that "Copyright (c)" is so prevalent, it'd be like writing "and &" or "% percent" | |
| lib/libc/stdlib/strtonum.3 | ||
|---|---|---|
| 18 | You (or whoever pushes the commit) can set this to the current date when it goes in | |
@rosenfeld_grumpf.hope-2000.org, we need to update the commit message to align with https://docs.freebsd.org/en/articles/committers-guide/#commit-log-message. How about this?
libc/stdlib: Port strtonumx() from Illumos #15365 Add strtonumx(), a companion to strtonum(3) that preserves its safety and error-reporting semantics while allowing the caller to specify a conversion base, similar to the strtol(3) family of functions. Reviewed by: emaste, kib, ziaee Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54270
I guess Illumos #15365 refers to something on https://code.illumos.org, but it's not easy to find. Could you either clarify, or we can simply use libc/stdlib: Port strtonumx() from Illumos for the subject.
Looks good!
I guess Illumos #15365 refers to something on https://code.illumos.org, but it's not easy to find. Could you either clarify, or we can simply use libc/stdlib: Port strtonumx() from Illumos for the subject.
That is the illumos issue number in the illumos issue tracker: https://www.illumos.org/issues/15365
I've added the link to the commit message in an "Obtained from" line as documented in the committer's guide. Please let me know if that is the correct way to handle it. If not, I guess it's better to just leave it out entirely.