ref: 140802c128089987e4f1382909f5a55d09132b75
parent: 3358f3f36b956bc8595e6e8ea0f6373e8f44f1f9
author: Arnold D. Robbins <arnold@skeeve.com>
date: Wed Jan 1 17:42:50 EST 2020
Small formatting cleanups in b.c.
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
* tran.c (syminit, arginit, envinit): Free sval member before
setting it. Thanks to valgrind.
+ * b.c: Small formatting cleanups in several routines.
2019-12-27 Arnold D. Robbins <arnold@skeeve.com>
--- a/b.c
+++ b/b.c
@@ -180,7 +180,7 @@
}
fa *mkdfa(const char *s, bool anchor) /* does the real work of making a dfa */
- /* anchor = 1 for anchored matches, else 0 */
+ /* anchor = true for anchored matches, else false */
{Node *p, *p1;
fa *f;
@@ -223,17 +223,17 @@
k = *(f->re[0].lfollow);
xfree(f->posns[2]);
f->posns[2] = intalloc(k + 1, __func__);
- for (i=0; i <= k; i++) {+ for (i = 0; i <= k; i++) {(f->posns[2])[i] = (f->re[0].lfollow)[i];
}
if ((f->posns[2])[1] == f->accept)
f->out[2] = 1;
- for (i=0; i < NCHARS; i++)
+ for (i = 0; i < NCHARS; i++)
f->gototab[2][i] = 0;
f->curstat = cgoto(f, 2, HAT);
if (anchor) {*f->posns[2] = k-1; /* leave out position 0 */
- for (i=0; i < k; i++) {+ for (i = 0; i < k; i++) {(f->posns[0])[i] = (f->posns[2])[i];
}
@@ -463,9 +463,10 @@
}
if (type(p) == CCL && (*(char *) right(p)) == '\0')
return(0); /* empty CCL */
- else return(1);
+ return(1);
case PLUS:
- if (first(left(p)) == 0) return(0);
+ if (first(left(p)) == 0)
+ return(0);
return(1);
case STAR:
case QUEST:
@@ -714,7 +715,7 @@
if (buf[--k] && ungetc(buf[k], f) == EOF)
FATAL("unable to ungetc '%c'", buf[k]);while (k > i + patlen);
- buf[k] = 0;
+ buf[k] = '\0';
return true;
}
else
--
⑨