[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/34] maint: dfa: convert #if-MBS_SUPPORT (copytoks)
From: |
Jim Meyering |
Subject: |
[PATCH 16/34] maint: dfa: convert #if-MBS_SUPPORT (copytoks) |
Date: |
Thu, 15 Sep 2011 12:27:59 +0200 |
From: Jim Meyering <address@hidden>
* src/dfa.c (copytoks): Use regular "if", not #if MBS_SUPPORT.'
---
src/dfa.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index 303fbda..9e3cb6a 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -1412,16 +1412,12 @@ static int depth; /* Current depth of a
hypothetical stack
static void
addtok_mb (token t, int mbprop)
{
-#if MBS_SUPPORT
- if (MB_CUR_MAX > 1)
+ if (MBS_SUPPORT && MB_CUR_MAX > 1)
{
REALLOC_IF_NECESSARY(dfa->multibyte_prop, dfa->nmultibyte_prop,
dfa->tindex + 1);
dfa->multibyte_prop[dfa->tindex] = mbprop;
}
-#else
- (void) mbprop;
-#endif
REALLOC_IF_NECESSARY(dfa->tokens, dfa->talloc, dfa->tindex + 1);
dfa->tokens[dfa->tindex++] = t;
@@ -1536,7 +1532,11 @@ addtok_wc (wint_t wc)
addtok(CAT);
}
}
+#else
+static void addtok_wc (wint_t wc) {}
+#endif
+#if MBS_SUPPORT
static void
add_utf8_anychar (void)
{
@@ -1629,8 +1629,7 @@ atom (void)
{
/* empty */
}
-#if MBS_SUPPORT
- else if (tok == WCHAR)
+ else if (MBS_SUPPORT && tok == WCHAR)
{
addtok_wc (case_fold ? towlower(wctok) : wctok);
#ifndef GREP
@@ -1643,8 +1642,7 @@ atom (void)
tok = lex();
}
-
- else if (tok == ANYCHAR && using_utf8())
+ else if (MBS_SUPPORT && tok == ANYCHAR && using_utf8())
{
/* For UTF-8 expand the period to a series of CSETs that define a valid
UTF-8 character. This avoids using the slow multibyte path. I'm
@@ -1656,8 +1654,6 @@ atom (void)
add_utf8_anychar();
tok = lex();
}
-#endif /* MBS_SUPPORT */
-
else if ((tok >= 0 && tok < NOTCHAR) || tok >= CSET || tok == BACKREF
|| tok == BEGLINE || tok == ENDLINE || tok == BEGWORD
#if MBS_SUPPORT
@@ -1710,11 +1706,9 @@ copytoks (int tindex, int ntokens)
for (i = 0; i < ntokens; ++i)
{
addtok(dfa->tokens[tindex + i]);
-#if MBS_SUPPORT
/* Update index into multibyte csets. */
- if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
+ if (MBS_SUPPORT && MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
-#endif
}
}
--
1.7.7.rc0.362.g5a14
[PATCH 02/34] maint: convert #if-MBS_SUPPORT (Fcompile, etc.), Jim Meyering, 2011/09/15
[PATCH 07/34] maint: dfa: convert #if-MBS_SUPPORT (dfafree), Jim Meyering, 2011/09/15
[PATCH 09/34] maint: dfa: convert #if-MBS_SUPPORT (free_mbdata), Jim Meyering, 2011/09/15
[PATCH 06/34] maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp, part1), Jim Meyering, 2011/09/15
[PATCH 10/34] maint: dfa: convert #if-MBS_SUPPORT (dfaexec), Jim Meyering, 2011/09/15
[PATCH 16/34] maint: dfa: convert #if-MBS_SUPPORT (copytoks),
Jim Meyering <=
[PATCH 17/34] maint: dfa: convert #if-MBS_SUPPORT (dfaparse), Jim Meyering, 2011/09/15
[PATCH 14/34] maint: dfa: convert #if-MBS_SUPPORT (parse_bracket_exp), Jim Meyering, 2011/09/15
[PATCH 18/34] maint: dfa: convert #if-MBS_SUPPORT (state_index), Jim Meyering, 2011/09/15
[PATCH 28/34] maint: dfa: avoid in-function "#if MBS_SUPPORT" tests, Jim Meyering, 2011/09/15
[PATCH 03/34] maint: convert #if-MBS_SUPPORT (kwsincr_case), Jim Meyering, 2011/09/15
[PATCH 33/34] maint: dfa: simplify multi-byte-related conditionals, Jim Meyering, 2011/09/15