[Top][All Lists]
[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
- [Gomp-discuss] CVS on savannah, Lars Segerlund, 2003/02/14
- [Gomp-discuss] Paperwork!, Scott Robert Ladd, 2003/02/14
- Re: [Gomp-discuss] Paperwork!, Steven Bosscher, 2003/02/14
- Re: [Gomp-discuss] Paperwork!, Biagio Lucini, 2003/02/15
- Re: [Gomp-discuss] Paperwork!, Steven Bosscher, 2003/02/15
- Re: [Gomp-discuss] Paperwork!, Biagio Lucini, 2003/02/15