From 0f36f5c5072caafecf1c774fe60d2cc25ab849a9 Mon Sep 17 00:00:00 2001 From: Norihiro Tanaka Date: Fri, 15 Jul 2016 07:44:32 +0900 Subject: [PATCH] dfa: Reindent dfa.c * src/dfa.c: Reindent this like: indent with indent --no-tabs -l79 -Tsize_t -Tbool -Twint_t -Tposition_set -Tmust dfa.c and adjust it. --- src/dfa.c | 47 ++++++++++++++++++++++++----------------------- 1 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/dfa.c b/src/dfa.c index f7e907b..b862fb3 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -321,10 +321,10 @@ struct dfa size_t nleaves; /* Number of leaves on the parse tree. */ size_t nregexps; /* Count of parallel regexps being built with dfaparse. */ - bool fast; /* The DFA is fast. */ - bool multibyte; /* MB_CUR_MAX > 1. */ - token utf8_anychar_classes[5]; /* To lower ANYCHAR in UTF-8 locales. */ - mbstate_t mbs; /* Multibyte conversion state. */ + bool fast; /* The DFA is fast. */ + bool multibyte; /* MB_CUR_MAX > 1. */ + token utf8_anychar_classes[5]; /* To lower ANYCHAR in UTF-8 locales. */ + mbstate_t mbs; /* Multibyte conversion state. */ /* dfaexec implementation. */ char *(*dfaexec) (struct dfa *, char const *, char *, @@ -357,12 +357,12 @@ struct dfa size_t mbcsets_alloc; /* Fields filled by the superset. */ - struct dfa *superset; /* Hint of the dfa. */ + struct dfa *superset; /* Hint of the dfa. */ /* Fields filled by the state builder. */ dfa_state *states; /* States of the dfa. */ state_num sindex; /* Index for adding new states. */ - size_t salloc; /* Number of states currently allocated. */ + size_t salloc; /* Number of states currently allocated. */ /* Fields filled by the parse tree->NFA conversion. */ position_set *follows; /* Array of follow sets, indexed by position @@ -372,7 +372,7 @@ struct dfa matching the given position in a string matching the regexp. Allocated to the maximum possible position index. */ - bool searchflag; /* We are supposed to build a searching + bool searchflag; /* We are supposed to build a searching as opposed to an exact matcher. A searching matcher finds the first and shortest string matching a regexp anywhere in the buffer, @@ -808,7 +808,7 @@ using_simple_locale (void) static char const *lexptr; /* Pointer to next input character. */ static size_t lexleft; /* Number of characters remaining. */ static token lasttok; /* Previous token returned; initially END. */ -static bool laststart; /* We're separated from beginning or (, +static bool laststart; /* We're separated from beginning or (, | only by zero-width characters. */ static size_t parens; /* Count of outstanding left parens. */ static int minrep, maxrep; /* Repeat counts for {m,n}. */ @@ -816,7 +816,7 @@ static int minrep, maxrep; /* Repeat counts for {m,n}. */ static int cur_mb_len = 1; /* Length of the multibyte representation of wctok. */ -static wint_t wctok; /* Wide character representation of the current +static wint_t wctok; /* Wide character representation of the current multibyte character, or WEOF if there was an encoding error. Used only if MB_CUR_MAX > 1. */ @@ -1000,7 +1000,7 @@ parse_bracket_exp (void) colon_warning_state = (c == ':'); do { - c1 = NOTCHAR; /* Mark c1 as not initialized. */ + c1 = NOTCHAR; /* Mark c1 as not initialized. */ colon_warning_state &= ~2; /* Note that if we're looking at some other [:...:] construct, @@ -1273,7 +1273,7 @@ lex (void) case '`': if (backslash && !(syntax_bits & RE_NO_GNU_OPS)) - return lasttok = BEGLINE; /* FIXME: should be beginning of string */ + return lasttok = BEGLINE; /* FIXME: should be beginning of string */ goto normal_char; case '\'': @@ -1364,7 +1364,8 @@ lex (void) if (maxrep < 0) maxrep = *p - '0'; else - maxrep = MIN (RE_DUP_MAX + 1, maxrep * 10 + *p - '0'); + maxrep + = MIN (RE_DUP_MAX + 1, maxrep * 10 + *p - '0'); } } } @@ -1942,7 +1943,7 @@ dfaparse (char const *s, size_t len, struct dfa *d) /* Copy one set to another. */ static void -copy (position_set const *src, position_set * dst) +copy (position_set const *src, position_set *dst) { if (dst->alloc < src->nelem) { @@ -1955,7 +1956,7 @@ copy (position_set const *src, position_set * dst) } static void -alloc_position_set (position_set * s, size_t size) +alloc_position_set (position_set *s, size_t size) { s->elems = xnmalloc (size, sizeof *s->elems); s->alloc = size; @@ -1967,7 +1968,7 @@ alloc_position_set (position_set * s, size_t size) then merge (logically-OR) P's constraints into the one in S. S->elems must point to an array large enough to hold the resulting set. */ static void -insert (position p, position_set * s) +insert (position p, position_set *s) { size_t count = s->nelem; size_t lo = 0, hi = count; @@ -1997,7 +1998,7 @@ insert (position p, position_set * s) /* Merge two sets of positions into a third. The result is exactly as if the positions of both sets were inserted into an initially empty set. */ static void -merge (position_set const *s1, position_set const *s2, position_set * m) +merge (position_set const *s1, position_set const *s2, position_set *m) { size_t i = 0, j = 0; @@ -2026,7 +2027,7 @@ merge (position_set const *s1, position_set const *s2, position_set * m) /* Delete a position from a set. */ static void -delete (position p, position_set * s) +delete (position p, position_set *s) { size_t i; @@ -2533,11 +2534,11 @@ dfastate (state_num s, struct dfa *d, state_num trans[]) size_t ngrps = 0; /* Number of groups actually used. */ position pos; /* Current position being considered. */ charclass matches; /* Set of matching characters. */ - charclass_word matchesf; /* Nonzero if matches is nonempty. */ + charclass_word matchesf; /* Nonzero if matches is nonempty. */ charclass intersect; /* Intersection with some label set. */ - charclass_word intersectf; /* Nonzero if intersect is nonempty. */ + charclass_word intersectf; /* Nonzero if intersect is nonempty. */ charclass leftovers; /* Stuff in the label that didn't match. */ - charclass_word leftoversf; /* Nonzero if leftovers is nonempty. */ + charclass_word leftoversf; /* Nonzero if leftovers is nonempty. */ position_set follows; /* Union of the follows of some group. */ position_set tmp; /* Temporary space for merging sets. */ int possible_contexts; /* Contexts that this group can match. */ @@ -2545,7 +2546,7 @@ dfastate (state_num s, struct dfa *d, state_num trans[]) state_num state; /* New state. */ state_num state_newline; /* New state on a newline transition. */ state_num state_letter; /* New state on a letter transition. */ - bool next_isnt_1st_byte = false; /* We can't add state0. */ + bool next_isnt_1st_byte = false; /* We can't add state0. */ size_t i, j, k; #ifdef DEBUG @@ -2605,8 +2606,8 @@ dfastate (state_num s, struct dfa *d, state_num trans[]) prtok (d->tokens[pos.index]); fprintf (stderr, " of"); for (j = 0; j < NOTCHAR; j++) - if (tstbit (j, matches)) - fprintf (stderr, " 0x%02zx", j); + if (tstbit (j, matches)) + fprintf (stderr, " 0x%02zx", j); fprintf (stderr, "\n"); #endif -- 1.7.1