[PATCH] parser: corrected xf86getBoolValue to use case insensitive compare

Dan Nicholson dbn.lists at gmail.com
Tue Feb 2 11:57:16 PST 2010


On Tue, Feb 2, 2010 at 6:43 AM, Oliver McFadden
<oliver.mcfadden at nokia.com> wrote:
> commit c6e8637e29e0ca11dfb35c02da7ca6002ac8c597 introduced this
> regression; it can cause existing config files to be parsed incorrectly.
>
> Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
> ---
>  hw/xfree86/parser/scan.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
> index b80fbfb..b0e0cdf 100644
> --- a/hw/xfree86/parser/scan.c
> +++ b/hw/xfree86/parser/scan.c
> @@ -1195,21 +1195,21 @@ xf86getBoolValue(Bool *val, const char *str)
>        if (*str == '\0') {
>                *val = TRUE;
>        } else {
> -               if (strcmp(str, "1") == 0)
> +               if (xf86NameCmp(str, "1") == 0)
>                        *val = TRUE;
> -               else if (strcmp(str, "on") == 0)
> +               else if (xf86NameCmp(str, "on") == 0)
>                        *val = TRUE;
> -               else if (strcmp(str, "true") == 0)
> +               else if (xf86NameCmp(str, "true") == 0)
>                        *val = TRUE;
> -               else if (strcmp(str, "yes") == 0)
> +               else if (xf86NameCmp(str, "yes") == 0)
>                        *val = TRUE;
> -               else if (strcmp(str, "0") == 0)
> +               else if (xf86NameCmp(str, "0") == 0)
>                        *val = FALSE;
> -               else if (strcmp(str, "off") == 0)
> +               else if (xf86NameCmp(str, "off") == 0)
>                        *val = FALSE;
> -               else if (strcmp(str, "false") == 0)
> +               else if (xf86NameCmp(str, "false") == 0)
>                        *val = FALSE;
> -               else if (strcmp(str, "no") == 0)
> +               else if (xf86NameCmp(str, "no") == 0)
>                        *val = FALSE;
>                else
>                        return FALSE;
> --
> 1.6.1

Oops. Can you change this to xf86nameCompare? That's actually
prototyped in parser/, and xf86NameCmp is just a wrapper around it.
Otherwise,

Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

--
Dan


More information about the xorg-devel mailing list