[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/34] maint: dfa: convert #if-MBS_SUPPORT (dfaexec)
From: |
Jim Meyering |
Subject: |
[PATCH 10/34] maint: dfa: convert #if-MBS_SUPPORT (dfaexec) |
Date: |
Thu, 15 Sep 2011 12:27:53 +0200 |
From: Jim Meyering <address@hidden>
* src/dfa.c (dfaexec): Use regular "if", not #if MBS_SUPPORT.
Also add curly braces around multi-line if/else blocks.
---
src/dfa.c | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index acd99aa..d27f2a1 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -3286,8 +3286,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
for (;;)
{
-#if MBS_SUPPORT
- if (d->mb_cur_max > 1)
+ if (MBS_SUPPORT && d->mb_cur_max > 1)
while ((t = trans[s]))
{
if (p > buf_end)
@@ -3320,16 +3319,17 @@ dfaexec (struct dfa *d, char const *begin, char *end,
trans = d->trans;
}
else
-#endif /* MBS_SUPPORT */
- while ((t = trans[s]) != 0)
{
- s1 = t[*p++];
- if ((t = trans[s1]) == 0)
+ while ((t = trans[s]) != 0)
{
- int tmp = s; s = s1; s1 = tmp; /* swap */
- break;
+ s1 = t[*p++];
+ if ((t = trans[s1]) == 0)
+ {
+ int tmp = s; s = s1; s1 = tmp; /* swap */
+ break;
+ }
+ s = t[*p++];
}
- s = t[*p++];
}
if (s >= 0 && (char *) p <= end && d->fails[s])
@@ -3338,20 +3338,17 @@ dfaexec (struct dfa *d, char const *begin, char *end,
{
if (backref)
*backref = (d->states[s].backref != 0);
-#if MBS_SUPPORT
- if (d->mb_cur_max > 1)
+ if (MBS_SUPPORT && d->mb_cur_max > 1)
{
free(mblen_buf);
free(inputwcs);
}
-#endif /* MBS_SUPPORT */
*end = saved_end;
return (char *) p;
}
s1 = s;
-#if MBS_SUPPORT
- if (d->mb_cur_max > 1)
+ if (MBS_SUPPORT && d->mb_cur_max > 1)
{
/* Can match with a multibyte character (and multicharacter
collating element). Transition table might be updated. */
@@ -3359,8 +3356,7 @@ dfaexec (struct dfa *d, char const *begin, char *end,
trans = d->trans;
}
else
-#endif /* MBS_SUPPORT */
- s = d->fails[s][*p++];
+ s = d->fails[s][*p++];
continue;
}
@@ -3379,13 +3375,11 @@ dfaexec (struct dfa *d, char const *begin, char *end,
/* Check if we've run off the end of the buffer. */
if ((char *) p > end)
{
-#if MBS_SUPPORT
- if (d->mb_cur_max > 1)
+ if (MBS_SUPPORT && d->mb_cur_max > 1)
{
free(mblen_buf);
free(inputwcs);
}
-#endif /* MBS_SUPPORT */
*end = saved_end;
return NULL;
}
--
1.7.7.rc0.362.g5a14
- Re: [PATCH 04/34] maint: convert #if-MBS_SUPPORT (EGexecute), (continued)
[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 <=
[PATCH 16/34] maint: dfa: convert #if-MBS_SUPPORT (copytoks), Jim Meyering, 2011/09/15
[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