[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep branch, master, updated. v2.9-59-g49684e0
From: |
Jim Meyering |
Subject: |
grep branch, master, updated. v2.9-59-g49684e0 |
Date: |
Fri, 16 Sep 2011 12:51:45 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".
The branch, master has been updated
via 49684e05ed0362928b9fd2d14ecc3153300b702f (commit)
via eb0e2d9d2b2d5930842e6b60a8e6e71f75378644 (commit)
via 786c10af2b70ed6f585362185a76566ba3e84a91 (commit)
via ba10005a6df3c2bb94cf85a6ddb28b26ff459af7 (commit)
from 93927af364aa09dc23a50ca8e4c9a62af0132c59 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=49684e05ed0362928b9fd2d14ecc3153300b702f
commit 49684e05ed0362928b9fd2d14ecc3153300b702f
Author: Jim Meyering <address@hidden>
Date: Mon Sep 12 15:34:17 2011 +0200
maint: dfa: simplify multi-byte-related conditionals
* src/dfa.c (setbit_case_fold_c, parse_bracket_exp, lex):
(addtok_mb, dfaparse): Change each "MBS_SUPPORT && MB_CUR_MAX > 1"
test to just "MB_CUR_MAX > 1".
* src/dfasearch.c (kwsincr_case, EGexecute): Likewise.
* src/kwsearch.c (Fcompile, Fexecute): Likewise.
* src/searchutils.c (kwsinit): Likewise.
* src/dfa.c (parse_bracket_exp): Convert
"if (!MBS_SUPPORT || MB_CUR_MAX == 1)" to
"if (MB_CUR_MAX == 1)" and do this:
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
diff --git a/src/dfa.c b/src/dfa.c
index a57353e..8611435 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -590,7 +590,7 @@ static inline bool setbit_wc (wint_t wc, charclass c) {
abort (); }
static void
setbit_case_fold_c (int b, charclass c)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
wint_t wc = btowc (b);
if (wc == WEOF)
@@ -834,7 +834,7 @@ parse_bracket_exp (void)
/* If pattern contains `[[:', `[[.', or `[[='. */
if (c1 == ':'
/* TODO: handle `[[.' and `[[=' also for MB_CUR_MAX == 1. */
- || (MBS_SUPPORT && MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
+ || (MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
)
{
size_t len = 0;
@@ -865,7 +865,7 @@ parse_bracket_exp (void)
if (!pred)
dfaerror(_("invalid character class"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && !pred->single_byte_only)
+ if (MB_CUR_MAX > 1 && !pred->single_byte_only)
{
/* Store the character class as wctype_t. */
wctype_t wt = wctype (class);
@@ -947,7 +947,7 @@ parse_bracket_exp (void)
&& (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS))
FETCH_WC(c2, wc2, _("unbalanced ["));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* When case folding map a range, say [m-z] (or even [M-z])
to the pair of ranges, [m-z] [M-Z]. */
@@ -1014,7 +1014,7 @@ parse_bracket_exp (void)
colon_warning_state |= (c == ':') ? 2 : 4;
- if (!MBS_SUPPORT || MB_CUR_MAX == 1)
+ if (MB_CUR_MAX == 1)
{
setbit_case_fold_c (c, ccl);
continue;
@@ -1047,7 +1047,7 @@ parse_bracket_exp (void)
if (colon_warning_state == 7)
dfawarn (_("character class syntax is [[:space:]], not [:space:]"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
static charclass zeroclass;
work_mbc->invert = invert;
@@ -1057,7 +1057,7 @@ parse_bracket_exp (void)
if (invert)
{
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
notset(ccl);
if (syntax_bits & RE_HAT_LISTS_NOT_NEWLINE)
clrbit(eolbyte, ccl);
@@ -1085,7 +1085,7 @@ lex (void)
"if (backslash) ...". */
for (i = 0; i < 2; ++i)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
FETCH_WC (c, wctok, NULL);
if ((int)c == EOF)
@@ -1314,7 +1314,7 @@ lex (void)
case '.':
if (backslash)
goto normal_char;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* In multibyte environment period must match with a single
character not a byte. So we use ANYCHAR. */
@@ -1367,7 +1367,7 @@ lex (void)
laststart = 0;
/* For multibyte character sets, folding is done in atom. Always
return WCHAR. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
return lasttok = WCHAR;
if (case_fold && isalpha(c))
@@ -1399,7 +1399,7 @@ static int depth; /* Current depth of a
hypothetical stack
static void
addtok_mb (token t, int mbprop)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
REALLOC_IF_NECESSARY(dfa->multibyte_prop, dfa->nmultibyte_prop,
dfa->tindex + 1);
@@ -1438,7 +1438,7 @@ static void addtok_wc (wint_t wc);
static void
addtok (token t)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && t == MBCSET)
+ if (MB_CUR_MAX > 1 && t == MBCSET)
{
bool need_or = false;
struct mb_char_classes *work_mbc = &dfa->mbcsets[dfa->nmbcsets - 1];
@@ -1694,7 +1694,7 @@ copytoks (int tindex, int ntokens)
{
addtok(dfa->tokens[tindex + i]);
/* Update index into multibyte csets. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
+ if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
}
}
@@ -1778,7 +1778,7 @@ dfaparse (char const *s, size_t len, struct dfa *d)
#ifdef LC_COLLATE
hard_LC_COLLATE = hard_locale (LC_COLLATE);
#endif
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
cur_mb_len = 0;
memset(&mbs, 0, sizeof mbs);
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 68c1966..c6fe1a5 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -77,7 +77,7 @@ static char const *
kwsincr_case (const char *must)
{
size_t n = strlen (must);
- const char *buf = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ const char *buf = (match_icase && MB_CUR_MAX > 1
? mbtolower (must, &n)
: must);
return kwsincr (kwset, buf, n);
@@ -214,7 +214,7 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
int backref, start, len, best_len;
struct kwsmatch kwsm;
size_t i, ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
diff --git a/src/kwsearch.c b/src/kwsearch.c
index 8911f3f..a481cfa 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -34,7 +34,7 @@ Fcompile (char const *pattern, size_t size)
{
char const *err;
size_t psize = size;
- char const *pat = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ char const *pat = (match_icase && MB_CUR_MAX > 1
? mbtolower (pattern, &psize)
: pattern);
@@ -83,7 +83,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
char eol = eolbyte;
struct kwsmatch kwsmatch;
size_t ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
@@ -100,8 +100,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
if (offset == (size_t) -1)
goto failure;
len = kwsmatch.size[0];
- if (MBS_SUPPORT
- && MB_CUR_MAX > 1
+ if (MB_CUR_MAX > 1
&& is_mb_middle (&mb_start, beg + offset, buf + size, len))
{
/* The match was a part of multibyte character, advance at least
diff --git a/src/searchutils.c b/src/searchutils.c
index e6a5cbb..3b3ae67 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -28,7 +28,7 @@ kwsinit (kwset_t *kwset)
static char trans[NCHAR];
int i;
- if (match_icase && MBS_SUPPORT && MB_CUR_MAX == 1)
+ if (match_icase && MB_CUR_MAX == 1)
{
for (i = 0; i < NCHAR; ++i)
trans[i] = tolower (i);
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=eb0e2d9d2b2d5930842e6b60a8e6e71f75378644
commit 49684e05ed0362928b9fd2d14ecc3153300b702f
Author: Jim Meyering <address@hidden>
Date: Mon Sep 12 15:34:17 2011 +0200
maint: dfa: simplify multi-byte-related conditionals
* src/dfa.c (setbit_case_fold_c, parse_bracket_exp, lex):
(addtok_mb, dfaparse): Change each "MBS_SUPPORT && MB_CUR_MAX > 1"
test to just "MB_CUR_MAX > 1".
* src/dfasearch.c (kwsincr_case, EGexecute): Likewise.
* src/kwsearch.c (Fcompile, Fexecute): Likewise.
* src/searchutils.c (kwsinit): Likewise.
* src/dfa.c (parse_bracket_exp): Convert
"if (!MBS_SUPPORT || MB_CUR_MAX == 1)" to
"if (MB_CUR_MAX == 1)" and do this:
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
diff --git a/src/dfa.c b/src/dfa.c
index a57353e..8611435 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -590,7 +590,7 @@ static inline bool setbit_wc (wint_t wc, charclass c) {
abort (); }
static void
setbit_case_fold_c (int b, charclass c)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
wint_t wc = btowc (b);
if (wc == WEOF)
@@ -834,7 +834,7 @@ parse_bracket_exp (void)
/* If pattern contains `[[:', `[[.', or `[[='. */
if (c1 == ':'
/* TODO: handle `[[.' and `[[=' also for MB_CUR_MAX == 1. */
- || (MBS_SUPPORT && MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
+ || (MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
)
{
size_t len = 0;
@@ -865,7 +865,7 @@ parse_bracket_exp (void)
if (!pred)
dfaerror(_("invalid character class"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && !pred->single_byte_only)
+ if (MB_CUR_MAX > 1 && !pred->single_byte_only)
{
/* Store the character class as wctype_t. */
wctype_t wt = wctype (class);
@@ -947,7 +947,7 @@ parse_bracket_exp (void)
&& (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS))
FETCH_WC(c2, wc2, _("unbalanced ["));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* When case folding map a range, say [m-z] (or even [M-z])
to the pair of ranges, [m-z] [M-Z]. */
@@ -1014,7 +1014,7 @@ parse_bracket_exp (void)
colon_warning_state |= (c == ':') ? 2 : 4;
- if (!MBS_SUPPORT || MB_CUR_MAX == 1)
+ if (MB_CUR_MAX == 1)
{
setbit_case_fold_c (c, ccl);
continue;
@@ -1047,7 +1047,7 @@ parse_bracket_exp (void)
if (colon_warning_state == 7)
dfawarn (_("character class syntax is [[:space:]], not [:space:]"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
static charclass zeroclass;
work_mbc->invert = invert;
@@ -1057,7 +1057,7 @@ parse_bracket_exp (void)
if (invert)
{
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
notset(ccl);
if (syntax_bits & RE_HAT_LISTS_NOT_NEWLINE)
clrbit(eolbyte, ccl);
@@ -1085,7 +1085,7 @@ lex (void)
"if (backslash) ...". */
for (i = 0; i < 2; ++i)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
FETCH_WC (c, wctok, NULL);
if ((int)c == EOF)
@@ -1314,7 +1314,7 @@ lex (void)
case '.':
if (backslash)
goto normal_char;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* In multibyte environment period must match with a single
character not a byte. So we use ANYCHAR. */
@@ -1367,7 +1367,7 @@ lex (void)
laststart = 0;
/* For multibyte character sets, folding is done in atom. Always
return WCHAR. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
return lasttok = WCHAR;
if (case_fold && isalpha(c))
@@ -1399,7 +1399,7 @@ static int depth; /* Current depth of a
hypothetical stack
static void
addtok_mb (token t, int mbprop)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
REALLOC_IF_NECESSARY(dfa->multibyte_prop, dfa->nmultibyte_prop,
dfa->tindex + 1);
@@ -1438,7 +1438,7 @@ static void addtok_wc (wint_t wc);
static void
addtok (token t)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && t == MBCSET)
+ if (MB_CUR_MAX > 1 && t == MBCSET)
{
bool need_or = false;
struct mb_char_classes *work_mbc = &dfa->mbcsets[dfa->nmbcsets - 1];
@@ -1694,7 +1694,7 @@ copytoks (int tindex, int ntokens)
{
addtok(dfa->tokens[tindex + i]);
/* Update index into multibyte csets. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
+ if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
}
}
@@ -1778,7 +1778,7 @@ dfaparse (char const *s, size_t len, struct dfa *d)
#ifdef LC_COLLATE
hard_LC_COLLATE = hard_locale (LC_COLLATE);
#endif
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
cur_mb_len = 0;
memset(&mbs, 0, sizeof mbs);
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 68c1966..c6fe1a5 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -77,7 +77,7 @@ static char const *
kwsincr_case (const char *must)
{
size_t n = strlen (must);
- const char *buf = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ const char *buf = (match_icase && MB_CUR_MAX > 1
? mbtolower (must, &n)
: must);
return kwsincr (kwset, buf, n);
@@ -214,7 +214,7 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
int backref, start, len, best_len;
struct kwsmatch kwsm;
size_t i, ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
diff --git a/src/kwsearch.c b/src/kwsearch.c
index 8911f3f..a481cfa 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -34,7 +34,7 @@ Fcompile (char const *pattern, size_t size)
{
char const *err;
size_t psize = size;
- char const *pat = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ char const *pat = (match_icase && MB_CUR_MAX > 1
? mbtolower (pattern, &psize)
: pattern);
@@ -83,7 +83,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
char eol = eolbyte;
struct kwsmatch kwsmatch;
size_t ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
@@ -100,8 +100,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
if (offset == (size_t) -1)
goto failure;
len = kwsmatch.size[0];
- if (MBS_SUPPORT
- && MB_CUR_MAX > 1
+ if (MB_CUR_MAX > 1
&& is_mb_middle (&mb_start, beg + offset, buf + size, len))
{
/* The match was a part of multibyte character, advance at least
diff --git a/src/searchutils.c b/src/searchutils.c
index e6a5cbb..3b3ae67 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -28,7 +28,7 @@ kwsinit (kwset_t *kwset)
static char trans[NCHAR];
int i;
- if (match_icase && MBS_SUPPORT && MB_CUR_MAX == 1)
+ if (match_icase && MB_CUR_MAX == 1)
{
for (i = 0; i < NCHAR; ++i)
trans[i] = tolower (i);
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=786c10af2b70ed6f585362185a76566ba3e84a91
commit 49684e05ed0362928b9fd2d14ecc3153300b702f
Author: Jim Meyering <address@hidden>
Date: Mon Sep 12 15:34:17 2011 +0200
maint: dfa: simplify multi-byte-related conditionals
* src/dfa.c (setbit_case_fold_c, parse_bracket_exp, lex):
(addtok_mb, dfaparse): Change each "MBS_SUPPORT && MB_CUR_MAX > 1"
test to just "MB_CUR_MAX > 1".
* src/dfasearch.c (kwsincr_case, EGexecute): Likewise.
* src/kwsearch.c (Fcompile, Fexecute): Likewise.
* src/searchutils.c (kwsinit): Likewise.
* src/dfa.c (parse_bracket_exp): Convert
"if (!MBS_SUPPORT || MB_CUR_MAX == 1)" to
"if (MB_CUR_MAX == 1)" and do this:
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
diff --git a/src/dfa.c b/src/dfa.c
index a57353e..8611435 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -590,7 +590,7 @@ static inline bool setbit_wc (wint_t wc, charclass c) {
abort (); }
static void
setbit_case_fold_c (int b, charclass c)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
wint_t wc = btowc (b);
if (wc == WEOF)
@@ -834,7 +834,7 @@ parse_bracket_exp (void)
/* If pattern contains `[[:', `[[.', or `[[='. */
if (c1 == ':'
/* TODO: handle `[[.' and `[[=' also for MB_CUR_MAX == 1. */
- || (MBS_SUPPORT && MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
+ || (MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
)
{
size_t len = 0;
@@ -865,7 +865,7 @@ parse_bracket_exp (void)
if (!pred)
dfaerror(_("invalid character class"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && !pred->single_byte_only)
+ if (MB_CUR_MAX > 1 && !pred->single_byte_only)
{
/* Store the character class as wctype_t. */
wctype_t wt = wctype (class);
@@ -947,7 +947,7 @@ parse_bracket_exp (void)
&& (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS))
FETCH_WC(c2, wc2, _("unbalanced ["));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* When case folding map a range, say [m-z] (or even [M-z])
to the pair of ranges, [m-z] [M-Z]. */
@@ -1014,7 +1014,7 @@ parse_bracket_exp (void)
colon_warning_state |= (c == ':') ? 2 : 4;
- if (!MBS_SUPPORT || MB_CUR_MAX == 1)
+ if (MB_CUR_MAX == 1)
{
setbit_case_fold_c (c, ccl);
continue;
@@ -1047,7 +1047,7 @@ parse_bracket_exp (void)
if (colon_warning_state == 7)
dfawarn (_("character class syntax is [[:space:]], not [:space:]"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
static charclass zeroclass;
work_mbc->invert = invert;
@@ -1057,7 +1057,7 @@ parse_bracket_exp (void)
if (invert)
{
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
notset(ccl);
if (syntax_bits & RE_HAT_LISTS_NOT_NEWLINE)
clrbit(eolbyte, ccl);
@@ -1085,7 +1085,7 @@ lex (void)
"if (backslash) ...". */
for (i = 0; i < 2; ++i)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
FETCH_WC (c, wctok, NULL);
if ((int)c == EOF)
@@ -1314,7 +1314,7 @@ lex (void)
case '.':
if (backslash)
goto normal_char;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* In multibyte environment period must match with a single
character not a byte. So we use ANYCHAR. */
@@ -1367,7 +1367,7 @@ lex (void)
laststart = 0;
/* For multibyte character sets, folding is done in atom. Always
return WCHAR. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
return lasttok = WCHAR;
if (case_fold && isalpha(c))
@@ -1399,7 +1399,7 @@ static int depth; /* Current depth of a
hypothetical stack
static void
addtok_mb (token t, int mbprop)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
REALLOC_IF_NECESSARY(dfa->multibyte_prop, dfa->nmultibyte_prop,
dfa->tindex + 1);
@@ -1438,7 +1438,7 @@ static void addtok_wc (wint_t wc);
static void
addtok (token t)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && t == MBCSET)
+ if (MB_CUR_MAX > 1 && t == MBCSET)
{
bool need_or = false;
struct mb_char_classes *work_mbc = &dfa->mbcsets[dfa->nmbcsets - 1];
@@ -1694,7 +1694,7 @@ copytoks (int tindex, int ntokens)
{
addtok(dfa->tokens[tindex + i]);
/* Update index into multibyte csets. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
+ if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
}
}
@@ -1778,7 +1778,7 @@ dfaparse (char const *s, size_t len, struct dfa *d)
#ifdef LC_COLLATE
hard_LC_COLLATE = hard_locale (LC_COLLATE);
#endif
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
cur_mb_len = 0;
memset(&mbs, 0, sizeof mbs);
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 68c1966..c6fe1a5 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -77,7 +77,7 @@ static char const *
kwsincr_case (const char *must)
{
size_t n = strlen (must);
- const char *buf = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ const char *buf = (match_icase && MB_CUR_MAX > 1
? mbtolower (must, &n)
: must);
return kwsincr (kwset, buf, n);
@@ -214,7 +214,7 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
int backref, start, len, best_len;
struct kwsmatch kwsm;
size_t i, ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
diff --git a/src/kwsearch.c b/src/kwsearch.c
index 8911f3f..a481cfa 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -34,7 +34,7 @@ Fcompile (char const *pattern, size_t size)
{
char const *err;
size_t psize = size;
- char const *pat = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ char const *pat = (match_icase && MB_CUR_MAX > 1
? mbtolower (pattern, &psize)
: pattern);
@@ -83,7 +83,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
char eol = eolbyte;
struct kwsmatch kwsmatch;
size_t ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
@@ -100,8 +100,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
if (offset == (size_t) -1)
goto failure;
len = kwsmatch.size[0];
- if (MBS_SUPPORT
- && MB_CUR_MAX > 1
+ if (MB_CUR_MAX > 1
&& is_mb_middle (&mb_start, beg + offset, buf + size, len))
{
/* The match was a part of multibyte character, advance at least
diff --git a/src/searchutils.c b/src/searchutils.c
index e6a5cbb..3b3ae67 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -28,7 +28,7 @@ kwsinit (kwset_t *kwset)
static char trans[NCHAR];
int i;
- if (match_icase && MBS_SUPPORT && MB_CUR_MAX == 1)
+ if (match_icase && MB_CUR_MAX == 1)
{
for (i = 0; i < NCHAR; ++i)
trans[i] = tolower (i);
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=ba10005a6df3c2bb94cf85a6ddb28b26ff459af7
commit 49684e05ed0362928b9fd2d14ecc3153300b702f
Author: Jim Meyering <address@hidden>
Date: Mon Sep 12 15:34:17 2011 +0200
maint: dfa: simplify multi-byte-related conditionals
* src/dfa.c (setbit_case_fold_c, parse_bracket_exp, lex):
(addtok_mb, dfaparse): Change each "MBS_SUPPORT && MB_CUR_MAX > 1"
test to just "MB_CUR_MAX > 1".
* src/dfasearch.c (kwsincr_case, EGexecute): Likewise.
* src/kwsearch.c (Fcompile, Fexecute): Likewise.
* src/searchutils.c (kwsinit): Likewise.
* src/dfa.c (parse_bracket_exp): Convert
"if (!MBS_SUPPORT || MB_CUR_MAX == 1)" to
"if (MB_CUR_MAX == 1)" and do this:
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
diff --git a/src/dfa.c b/src/dfa.c
index a57353e..8611435 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -590,7 +590,7 @@ static inline bool setbit_wc (wint_t wc, charclass c) {
abort (); }
static void
setbit_case_fold_c (int b, charclass c)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
wint_t wc = btowc (b);
if (wc == WEOF)
@@ -834,7 +834,7 @@ parse_bracket_exp (void)
/* If pattern contains `[[:', `[[.', or `[[='. */
if (c1 == ':'
/* TODO: handle `[[.' and `[[=' also for MB_CUR_MAX == 1. */
- || (MBS_SUPPORT && MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
+ || (MB_CUR_MAX > 1 && (c1 == '.' || c1 == '='))
)
{
size_t len = 0;
@@ -865,7 +865,7 @@ parse_bracket_exp (void)
if (!pred)
dfaerror(_("invalid character class"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && !pred->single_byte_only)
+ if (MB_CUR_MAX > 1 && !pred->single_byte_only)
{
/* Store the character class as wctype_t. */
wctype_t wt = wctype (class);
@@ -947,7 +947,7 @@ parse_bracket_exp (void)
&& (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS))
FETCH_WC(c2, wc2, _("unbalanced ["));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* When case folding map a range, say [m-z] (or even [M-z])
to the pair of ranges, [m-z] [M-Z]. */
@@ -1014,7 +1014,7 @@ parse_bracket_exp (void)
colon_warning_state |= (c == ':') ? 2 : 4;
- if (!MBS_SUPPORT || MB_CUR_MAX == 1)
+ if (MB_CUR_MAX == 1)
{
setbit_case_fold_c (c, ccl);
continue;
@@ -1047,7 +1047,7 @@ parse_bracket_exp (void)
if (colon_warning_state == 7)
dfawarn (_("character class syntax is [[:space:]], not [:space:]"));
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
static charclass zeroclass;
work_mbc->invert = invert;
@@ -1057,7 +1057,7 @@ parse_bracket_exp (void)
if (invert)
{
- assert(!MBS_SUPPORT || MB_CUR_MAX == 1);
+ assert(MB_CUR_MAX == 1);
notset(ccl);
if (syntax_bits & RE_HAT_LISTS_NOT_NEWLINE)
clrbit(eolbyte, ccl);
@@ -1085,7 +1085,7 @@ lex (void)
"if (backslash) ...". */
for (i = 0; i < 2; ++i)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
FETCH_WC (c, wctok, NULL);
if ((int)c == EOF)
@@ -1314,7 +1314,7 @@ lex (void)
case '.':
if (backslash)
goto normal_char;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
/* In multibyte environment period must match with a single
character not a byte. So we use ANYCHAR. */
@@ -1367,7 +1367,7 @@ lex (void)
laststart = 0;
/* For multibyte character sets, folding is done in atom. Always
return WCHAR. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
return lasttok = WCHAR;
if (case_fold && isalpha(c))
@@ -1399,7 +1399,7 @@ static int depth; /* Current depth of a
hypothetical stack
static void
addtok_mb (token t, int mbprop)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
REALLOC_IF_NECESSARY(dfa->multibyte_prop, dfa->nmultibyte_prop,
dfa->tindex + 1);
@@ -1438,7 +1438,7 @@ static void addtok_wc (wint_t wc);
static void
addtok (token t)
{
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && t == MBCSET)
+ if (MB_CUR_MAX > 1 && t == MBCSET)
{
bool need_or = false;
struct mb_char_classes *work_mbc = &dfa->mbcsets[dfa->nmbcsets - 1];
@@ -1694,7 +1694,7 @@ copytoks (int tindex, int ntokens)
{
addtok(dfa->tokens[tindex + i]);
/* Update index into multibyte csets. */
- if (MBS_SUPPORT && MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
+ if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
}
}
@@ -1778,7 +1778,7 @@ dfaparse (char const *s, size_t len, struct dfa *d)
#ifdef LC_COLLATE
hard_LC_COLLATE = hard_locale (LC_COLLATE);
#endif
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
cur_mb_len = 0;
memset(&mbs, 0, sizeof mbs);
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 68c1966..c6fe1a5 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -77,7 +77,7 @@ static char const *
kwsincr_case (const char *must)
{
size_t n = strlen (must);
- const char *buf = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ const char *buf = (match_icase && MB_CUR_MAX > 1
? mbtolower (must, &n)
: must);
return kwsincr (kwset, buf, n);
@@ -214,7 +214,7 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
int backref, start, len, best_len;
struct kwsmatch kwsm;
size_t i, ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
diff --git a/src/kwsearch.c b/src/kwsearch.c
index 8911f3f..a481cfa 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -34,7 +34,7 @@ Fcompile (char const *pattern, size_t size)
{
char const *err;
size_t psize = size;
- char const *pat = (MBS_SUPPORT && match_icase && MB_CUR_MAX > 1
+ char const *pat = (match_icase && MB_CUR_MAX > 1
? mbtolower (pattern, &psize)
: pattern);
@@ -83,7 +83,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
char eol = eolbyte;
struct kwsmatch kwsmatch;
size_t ret_val;
- if (MBS_SUPPORT && MB_CUR_MAX > 1)
+ if (MB_CUR_MAX > 1)
{
if (match_icase)
{
@@ -100,8 +100,7 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
if (offset == (size_t) -1)
goto failure;
len = kwsmatch.size[0];
- if (MBS_SUPPORT
- && MB_CUR_MAX > 1
+ if (MB_CUR_MAX > 1
&& is_mb_middle (&mb_start, beg + offset, buf + size, len))
{
/* The match was a part of multibyte character, advance at least
diff --git a/src/searchutils.c b/src/searchutils.c
index e6a5cbb..3b3ae67 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -28,7 +28,7 @@ kwsinit (kwset_t *kwset)
static char trans[NCHAR];
int i;
- if (match_icase && MBS_SUPPORT && MB_CUR_MAX == 1)
+ if (match_icase && MB_CUR_MAX == 1)
{
for (i = 0; i < NCHAR; ++i)
trans[i] = tolower (i);
-----------------------------------------------------------------------
Summary of changes:
src/dfa.c | 51 +++++++++++++++++++++++----------------------------
src/dfasearch.c | 4 ++--
src/kwsearch.c | 7 +++----
src/mbsupport.h | 5 +++++
src/searchutils.c | 2 +-
5 files changed, 34 insertions(+), 35 deletions(-)
hooks/post-receive
--
grep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grep branch, master, updated. v2.9-59-g49684e0,
Jim Meyering <=