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



christos%zoulas.com@localhost (Christos Zoulas) wrote:
 |On Jan 14,  1:35am, n54%gmx.com@localhost ("Kamil Rytarowski") wrote:
 |-- Subject: Re: Reuse strtonum(3) and reallocarray(3) from OpenBSD
 || Christos Zoulas wrote:
 ||> I still don't get what you buy by having 2 sets of functions \
 ||> to save a passed
 ||> NULL pointer... Aside confusion.
 || 
 || Remove duplication of information returned to caller, related \
 || to partial conversion.
 || Also returning error for valid conversion is (for me) misguiding.
 || 
 || What do you think about this to return ENOTSUP only if:
 || - endptr was passed as NULL and
 || - there happened partial conversion.
 |
 |What about if no characters match? How do you tell the difference?
 |So if endptr != NULL behave differently? This is confusing.
 |
 || Then it will be reduced to strtoi/strtou.
 || 
 || If you will ack, then I will submit new patches, this time \
 || without regenerated configure and config.h.
 |
 |What do others think?

Because i said something at the beginning.
Despite (liking my C++ thing the most and) sitting on top of the
errno-using strtoimax() (iirc) i seem to recall that i liked your
version.

Generalize common/lib/libc/stdlib/ stuff so that the engines don't
use errno, place on top of those adjustments all the others, they
are only shallow wrappers anyway.
My other opinion is useless since tmux and openssh will surely
remain in the NetBSD base system, thus offering the shitty shitty
shitty strtonum natively would be a win.
I in addition would vaporise the toul* and tol* to a single umax
and use precalculated cutlimits since as a non-mathematician
i don't think it matters for two's complement and a division was
40 cycles back then and especially with conditional moves or ARM
predicates (what i think) cramping limits after having the result
is still cheaper than anything else.

--steffen


Home | Main Index | Thread Index | Old Index