Christian Hesse <[email protected]> on Fri, 2018/11/23 17:08:
> "Jason A. Donenfeld" <[email protected]> on Fri, 2018/10/19 00:52:
> > Hey Christian,
> > 
> > We should indeed introduce some sanitation helpers to deal with these
> > in the general case. API suggestion:
> > 
> > type_t parse_int(const char *str, type_t min, type_t max, type_t
> > fallback_if_invalid);
> > 
> > What would you think of that?  
> 
> My intention was to add a special value 0. How about this?
> 
> type_t parse_int(const char *str, type_t min, type_t max, type_t
> default_if_zero, type_t fallback_if_invalid);

As atoi() does not return error there is no "invalid"... Looks like we have
to go with:

type_t parse_int(const char *str, type_t min, type_t max, type_t
default_if_zero);
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

Attachment: pgpHHF_tKGKfF.pgp
Description: OpenPGP digital signature

_______________________________________________
CGit mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to