bug-grep
[Top][All Lists]
Advanced

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

Re: [PATCH] simplify parsing of [a-z]


From: Aharon Robbins
Subject: Re: [PATCH] simplify parsing of [a-z]
Date: Mon, 08 Mar 2010 20:44:08 +0200

Jim,

You're right - this is a problem on K&R compilers as well as on some
compilers with ANSI prototypes that aren't really ANSI (Ultrix seems to
want to come to mind).

It was once upon a time an issue for gawk; I don't know if it still is
or if the world has since made enough progress.

I will put this in for now, but will revert it to manual initialization
if testing finds a system still in use where that's necessary.

Thanks,

Arnold

> From: Jim Meyering <address@hidden>
> To: Paolo Bonzini <address@hidden>
> Date: Mon, 08 Mar 2010 10:40:17 +0100
> Cc: address@hidden
> Subject: Re: [PATCH] simplify parsing of [a-z]
>
> 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.
>




reply via email to

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