[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] simplify parsing of [a-z]
From: |
Jim Meyering |
Subject: |
Re: [PATCH] simplify parsing of [a-z] |
Date: |
Mon, 08 Mar 2010 10:40:17 +0100 |
Paolo Bonzini wrote:
> * src/dfa.c (in_coll_range): New.
> (lex): Use it instead of regcomp/regexec.
>
> +static int
> +in_coll_range (char ch, char from, char to)
> +{
> + char c[6] = { from, 0, ch, 0, to, 0 };
> + return strcoll (&c[0], &c[2]) <= 0 && 0 <= strcoll (&c[2], &c[4]);
> +}
This looks like a fine clean-up.
I have a vague recollection that automatic initializers
like this are not always accepted:
char c[6] = { from, 0, ch, 0, to, 0 };
However, the above is nicer syntax than writing it out,
so I'd be happy to leave it, and adjust only if someone
actually reports a problem.