[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rational Range Interpretation patches
From: |
Aharon Robbins |
Subject: |
Re: Rational Range Interpretation patches |
Date: |
Mon, 12 Dec 2011 09:23:57 +0200 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Hi Paolo.
> Date: Sat, 10 Dec 2011 18:10:13 +0100
> From: Paolo Bonzini <address@hidden>
> To: Aharon Robbins <address@hidden>
> CC: address@hidden
> Subject: Re: Rational Range Interpretation patches
>
> On 12/01/2011 09:21 PM, Aharon Robbins wrote:
> > diff --git a/src/dfa.c b/src/dfa.c
> > index 26ea4b5..d077d95 100644
>
> [snip]
>
> ...
>
> You're not changing the "/* match with a range? */" part of
> match_mb_charset.
>
> Paolo
Good catch. Thanks. Have you input for a test case I can add to the
gawk test suite?
I think the patch below does the trick (relative to gawk's dfa.c but it
should drop into grep's).
Arnold
------------------------------------------------
diff --git a/dfa.c b/dfa.c
index 37ddc1b..eeded08 100644
--- a/dfa.c
+++ b/dfa.c
@@ -2887,7 +2887,6 @@ match_mb_charset (struct dfa *d, int s, position pos, int
idx)
with which this operator match. */
int op_len; /* Length of the operator. */
char buffer[128];
- wchar_t wcbuf[6];
/* Pointer to the structure to which we are currently refering. */
struct mb_char_classes *work_mbc;
@@ -2964,17 +2963,11 @@ match_mb_charset (struct dfa *d, int s, position pos,
int idx)
}
}
- wcbuf[0] = wc;
- wcbuf[1] = wcbuf[3] = wcbuf[5] = '\0';
-
/* match with a range? */
for (i = 0; i<work_mbc->nranges; i++)
{
- wcbuf[2] = work_mbc->range_sts[i];
- wcbuf[4] = work_mbc->range_ends[i];
-
- if (wcscoll(wcbuf, wcbuf+2) >= 0 &&
- wcscoll(wcbuf+4, wcbuf) >= 0)
+ if (work_mbc->range_sts[i] <= wc &&
+ wc <= work_mbc->range_ends[i])
goto charset_matched;
}