Small formatting cleanups in b.c.

This commit is contained in:
Arnold D. Robbins 2020-01-01 22:42:50 +02:00
parent 3358f3f36b
commit 140802c128
2 changed files with 9 additions and 7 deletions

View File

@ -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>

9
b.c
View File

@ -180,7 +180,7 @@ fa *makedfa(const char *s, bool anchor) /* returns dfa for reg expr s */
}
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;
@ -463,9 +463,10 @@ int first(Node *p) /* collects initially active leaves of p into setvec */
}
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 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum)
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