gomp-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Gomp-discuss] It's time to populate !


From: Steven Bosscher
Subject: RE: [Gomp-discuss] It's time to populate !
Date: 15 Feb 2003 13:50:04 +0100

Op za 15-02-2003, om 13:20 schreef Steven Bosscher:

> static int
> get_boolean (const char * value)

Wheee -- I was apparently still half asleep when I wrote this:

> 
>   /* Any string longer than 5 chars doesn't make sense at this point.  */
>   if (i > 5)
>     return -1;

This is obviously quite broken.  Should be something like
"if (i != 4 && i != 5)".

> 
>   /* Uppercase the trimmed string.  */
>   for (j = 0; j <= i; j++)
>     {
>       if (islower (value[j]))
>       value[j] = toupper (value[j]);  
>     }
> 
>   /* See what we've got.  */
>   if (!strncmp (value, "TRUE", i))
>     return 1;
>   else if (!strncmp (value, "FALSE", i))
>     return 0;
>   else
>     return -1;
> }


Should not uppercase the string.  Instead should use
"strncasecmp(value, "TRUE"|"FALSE", i)" etc...

Greetz
Steven






reply via email to

[Prev in Thread] Current Thread [Next in Thread]