diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-05-25 21:01:12 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-05-25 21:01:12 +0000 |
commit | e69bd3c404b0713d8e6c45cbda62ce1e4dfd572e (patch) | |
tree | 2cf0851719cd2baf75aacfcda744a0a7a343f104 /lib | |
parent | e2379a9d04a0ff977114351547afb8a0d42f96d7 (diff) |
KNF with respect to indentation; no code change
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/regex/engine.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c index 6b99b1c3071..4acb80b0e33 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.21 2016/05/25 20:48:22 schwarze Exp $ */ +/* $OpenBSD: engine.c,v 1.22 2016/05/25 21:01:11 schwarze Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. @@ -156,7 +156,7 @@ matcher(struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], if (g->must != NULL) { for (dp = start; dp < stop; dp++) if (*dp == g->must[0] && stop - dp >= g->mlen && - memcmp(dp, g->must, (size_t)g->mlen) == 0) + memcmp(dp, g->must, (size_t)g->mlen) == 0) break; if (dp == stop) /* we didn't find g->must */ return(REG_NOMATCH); @@ -205,7 +205,7 @@ matcher(struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], /* oh my, he wants the subexpressions... */ if (m->pmatch == NULL) m->pmatch = reallocarray(NULL, m->g->nsub + 1, - sizeof(regmatch_t)); + sizeof(regmatch_t)); if (m->pmatch == NULL) { STATETEARDOWN(m); return(REG_ESPACE); @@ -693,31 +693,30 @@ fast(struct match *m, char *start, char *stop, sopno startst, sopno stopst) /* is there an EOL and/or BOL between lastc and c? */ flagch = '\0'; i = 0; - if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + if ((lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL))) { flagch = BOL; i = m->g->nbol; } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_NOTEOL)) ) { + if ((c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL)) ) { flagch = (flagch == BOL) ? BOLEOL : EOL; i += m->g->neol; } if (i != 0) { for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); + st = step(m->g, startst, stopst, + st, flagch, st); SP("boleol", st, c); } /* how about a word boundary? */ - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && - (c != OUT && ISWORD(c)) ) { + if ((flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && + (c != OUT && ISWORD(c))) flagch = BOW; - } - if ( (lastc != OUT && ISWORD(lastc)) && - (flagch == EOL || (c != OUT && !ISWORD(c))) ) { + if ((lastc != OUT && ISWORD(lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(c)))) flagch = EOW; - } if (flagch == BOW || flagch == EOW) { st = step(m->g, startst, stopst, st, flagch, st); SP("boweow", st, c); @@ -775,31 +774,30 @@ slow(struct match *m, char *start, char *stop, sopno startst, sopno stopst) /* is there an EOL and/or BOL between lastc and c? */ flagch = '\0'; i = 0; - if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + if ((lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL))) { flagch = BOL; i = m->g->nbol; } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_NOTEOL)) ) { + if ((c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL))) { flagch = (flagch == BOL) ? BOLEOL : EOL; i += m->g->neol; } if (i != 0) { for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); + st = step(m->g, startst, stopst, + st, flagch, st); SP("sboleol", st, c); } /* how about a word boundary? */ - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && - (c != OUT && ISWORD(c)) ) { + if ((flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && + (c != OUT && ISWORD(c))) flagch = BOW; - } - if ( (lastc != OUT && ISWORD(lastc)) && - (flagch == EOL || (c != OUT && !ISWORD(c))) ) { + if ((lastc != OUT && ISWORD(lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(c)))) flagch = EOW; - } if (flagch == BOW || flagch == EOW) { st = step(m->g, startst, stopst, st, flagch, st); SP("sboweow", st, c); @@ -916,8 +914,8 @@ step(struct re_guts *g, case OOR1: /* done a branch, find the O_CH */ if (ISSTATEIN(aft, here)) { for (look = 1; - OP(s = g->strip[pc+look]) != O_CH; - look += OPND(s)) + OP(s = g->strip[pc+look]) != O_CH; + look += OPND(s)) assert(OP(s) == OOR2); FWD(aft, aft, look); } @@ -957,11 +955,12 @@ print(struct match *m, char *caption, states st, int ch, FILE *d) (void)fprintf(d, "%s", caption); (void)fprintf(d, " %s", pchar(ch)); - for (i = 0; i < g->nstates; i++) + for (i = 0; i < g->nstates; i++) { if (ISSET(st, i)) { (void)fprintf(d, "%s%d", (first) ? "\t" : ", ", i); first = 0; } + } (void)fprintf(d, "\n"); } |