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 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.

Well, I was thinking about this use-case and if there is need to differentiate
partial conversion with and without parsed digits.

A candidate would be to set *rerror to ECANCELED in this case.

However I did it the other way, I took your original work and renamed rerror to rstatus,
as ENOTSUP is not necessarily an error, as it might be a valid status.

> 
> | 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?
> 
> christos
> 

If this iota change will be accepted, feel free to add your names to appropriate places.

Nihil obstat from my side.

Attachment: patch-src-common
Description: Binary data

Attachment: patch-src-include
Description: Binary data

Attachment: patch-src-lib
Description: Binary data

Attachment: patch-src-sys
Description: Binary data

Attachment: patch-src-tools
Description: Binary data



Home | Main Index | Thread Index | Old Index