=================================================================== RCS file: /cvs/cvs/blind/parse.y,v retrieving revision 1.11 retrieving revision 1.15 diff -u -p -r1.11 -r1.15 --- blind/parse.y 2022/03/29 20:57:40 1.11 +++ blind/parse.y 2022/04/03 13:52:00 1.15 @@ -26,14 +26,13 @@ #include "log.h" static struct file { - FILE *stream; - char *name; - size_t ungetpos; - size_t ungetsize; - u_char *ungetbuf; - int eof_reached; - int lineno; - int errors; + FILE *stream; + char *name; + size_t ungetpos; + size_t ungetsize; + u_char *ungetbuf; + int eof_reached; + int lineno; } *f; int lookup(char *); @@ -84,7 +83,7 @@ typedef struct { grammar : | grammar '\n' | grammar set '\n' - | grammar error '\n' { f->errors++; } + | grammar error '\n' { errors++; } ; set : SET EXPIRE NUMBER { @@ -111,7 +110,7 @@ yyerror(const char *fmt, ...) va_list ap; char *msg; - f->errors++; + errors++; va_start(ap, fmt); if (vasprintf(&msg, fmt, ap) == -1) log_fatal("yyerror vasprintf"); @@ -198,7 +197,6 @@ lgetc(int quotec) if ((c = igetc()) == EOF) { yyerror("reached end of file while parsing " "quoted string"); - // if (file == top || config_pop() == EOF) if (config_pop() == EOF) return (EOF); return (quotec); @@ -227,7 +225,6 @@ lgetc(int quotec) return ('\n'); } while (c == EOF) { - //if (file == top || config_pop() == EOF) if (config_pop() == EOF) return (EOF); c = igetc(); @@ -443,9 +440,7 @@ config_load(struct blind *temp) return (-1); } - yyparse(); - errors = f->errors; - free(f); + yyparse(); // setup @@ -503,6 +498,7 @@ config_pop(void) fclose(f->stream); free(f->name); free(f->ungetbuf); + free(f); return (EOF); }