diff options
author | Jim Meyering <meyering@redhat.com> | 2011-06-02 18:03:49 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-06-07 10:51:35 +0200 |
commit | cdd225afe8e94e87933642ed54d24ebdbac85757 (patch) | |
tree | c6716ee50bf2b0a81c0b42e0ef50b82da99bcd75 /src | |
parent | a5258004a87174122463f8160ea0eb6781fa2c95 (diff) | |
download | grep-cdd225afe8e94e87933642ed54d24ebdbac85757.tar.gz |
fix the [...] bug also for relatively unusual uni-byte encodings
* src/dfa.c (setbit_case_fold): Also handle uni-byte locales
like the one mentioned in the original report: see 2011-05-07
commit d98338eb. Re-reported by Santiago Ruano Rincón.
Note that most uni-byte locales are not affected.
* NEWS (Bug fixes): Mention it.
Diffstat (limited to 'src')
-rw-r--r-- | src/dfa.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -573,10 +573,14 @@ setbit_case_fold ( else { #if MBS_SUPPORT - int b2 = wctob ((unsigned char) b); - if (b2 == EOF || b2 == b) + /* Below, note how when b2 != b and we have a uni-byte locale + (MB_CUR_MAX == 1), we set b = b2. I.e., in a uni-byte locale, + we can safely call setbit with a non-EOF value returned by wctob. */ + int b2 = wctob (b); + if (b2 == EOF || b2 == b || (MB_CUR_MAX == 1 ? (b=b2), 1 : 0)) #endif - setbit (b, c); + if (b < NOTCHAR) + setbit (b, c); } } |