> On Mon, May 25, 2009 at 2:21 PM, Adrian Chadd <adrian_at_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
Received on Tue May 26 2009 - 03:50:59 MDT
This archive was generated by hypermail 2.2.0 : Thu May 28 2009 - 12:00:02 MDT