> On Mon, May 25, 2009 at 2:21 PM, Adrian Chadd <adr...@squid-cache.org>
> wrote:
>> int
>> isUnsignedNumeric(const char *str)
>> {
>> Â  Â for (; *str; str++) {
>> Â  Â  Â  Â if (! isdigit(*str))
>> Â  Â  Â  Â  Â  Â return -1;
>> Â  Â }
>> Â  Â return 1;
>> }
>
> Wouldn't returning 0 on false instead of -1 be easier?
> Just a random thought..
>

Actually. Being squid-3 we should be using true/false bool types.
I don't think adding a new requirement for nul-terminated strings is good
either.

Adri, if you could add this to the bit-n-pieces in tools.cc with the
following alterations;
 * bool return type
 * accept char* and length of string to test:
     ie "for (; *str && len>=0; str++) { --len; "


Amos


Reply via email to