Page MenuHomeFreeBSD

libc/stdlib: port illumos#15365: strtonumx() would be a useful companion to strtonum()
AcceptedPublic

Authored by rosenfeld_grumpf.hope-2000.org on Wed, Dec 17, 4:10 PM.
Tags
None
Referenced Files
F139932120: D54270.diff
Thu, Dec 18, 3:38 AM
F139923743: D54270.id168267.diff
Thu, Dec 18, 1:32 AM
F139913259: D54270.id168267.diff
Wed, Dec 17, 10:43 PM
F139911775: D54270.id.diff
Wed, Dec 17, 10:24 PM
F139909249: D54270.diff
Wed, Dec 17, 9:42 PM
Subscribers

Details

Reviewers
kib
des
emaste
Summary

From the strtonum(3) manpage:

strtonum() is an OpenBSD extension. The existing alternatives, such as
atoi(3C) and strtol(3C), are either impossible or difficult to use
safely.

It would be useful if there was a new function that had the use and safety
properties of strtonum() but which understood base prefixes like the
strtol(3) family of functions does.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69336
Build 66219: arc lint + arc unit

Event Timeline

This looks fine to me, but I prefer to have more eyes on it before is is engraved into the libc.

This revision is now accepted and ready to land.Wed, Dec 17, 4:30 PM

Wow, thanks so much for sharing this with us!

lib/libc/stdlib/strtonum.3
194

We prefer to use version numbers here.

lib/libc/stdlib/strtonum.c
5

I'm not sure if it's necessary, but all our style guides use this.

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"