From 1b83de344966d835056e0c8881b06ab83b1c7ab0 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 1 Apr 2010 17:55:20 +0200 Subject: maint: dfa: convert #if-MBS_SUPPORT (dfaexec) * 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 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/dfa.c b/src/dfa.c index 645aba83..a37d059c 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -3280,8 +3280,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) @@ -3314,16 +3313,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]) @@ -3332,20 +3332,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. */ @@ -3353,8 +3350,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; } @@ -3373,13 +3369,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; } -- cgit v1.2.1