tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Reuse strtonum(3) and reallocarray(3) from OpenBSD
Steffen Nurpmeso wrote:
> "Kamil Rytarowski" <n54%gmx.com@localhost> wrote:
> |Hello,
> |
> |I've prepared a small patch adding strtonum(3)
>
> This is a ridiculous interface.
> You just cannot object to what Jörg Sonnenberger said and at the
> same time propose a function that requires multiple steps in order
> to decide wether the return value is a valid one or indicates an
> error condition instead.
> If you want at all costs a good number converting facility, use
> e.g. that:
>
> [...]
Hello Steffen,
Thank you for your feedback.
Please don't mind, but this is not my argument, its superiority.
The API is clear and it's doing well for what it's meant.
It's also preventing from simple bugs, like the one of mine, when I was porting timeout for NetBSD:
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/timeout/timeout.c?annotate=1.4
Please see:
find /usr/src -name '*.[ch]' -exec grep strtonum {} \;|nl
It gives me 136 results (NetBSD-current)
We already DO implement strtonum(3) MANY times in our sources, doing it system-wide and in a central place is major improvement. Not just for reusing the same code, but exporting it for custom user-space software.
As long as it's not system-wide new code using strtonum(3) in our sources will need compat layer and implementation / reimplementation of this function with the ridiculous interface.
BTW. Interesting language, what's it?
Regards,
Home |
Main Index |
Thread Index |
Old Index