diff options
-rw-r--r-- | main.c | 22 | ||||
-rw-r--r-- | mandoc.h | 5 | ||||
-rw-r--r-- | read.c | 13 |
3 files changed, 3 insertions, 37 deletions
@@ -54,7 +54,6 @@ enum outt { struct curparse { struct mparse *mp; - const char *file; /* current file-name */ enum mandoclevel wlevel; /* ignore messages below this */ int wstop; /* stop after a file with a warning */ enum outt outtype; /* which output to use */ @@ -182,8 +181,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "static buffer exhausted", }; -static void evt_close(void *, const char *); -static int evt_open(void *, const char *); static int moptions(enum mparset *, char *); static void mmsg(enum mandocerr, enum mandoclevel, const char *, int, int, const char *); @@ -243,7 +240,7 @@ main(int argc, char *argv[]) /* NOTREACHED */ } - curp.mp = mparse_alloc(type, evt_open, evt_close, curp.wlevel, mmsg, &curp); + curp.mp = mparse_alloc(type, curp.wlevel, mmsg, &curp); argc -= optind; argv += optind; @@ -293,23 +290,6 @@ usage(void) exit((int)MANDOCLEVEL_BADARG); } -static int -evt_open(void *arg, const char *file) -{ - - evt_close(arg, file); - return(1); -} - -static void -evt_close(void *arg, const char *file) -{ - struct curparse *p; - - p = (struct curparse *)arg; - p->file = file; -} - static void parse(struct curparse *curp, int fd, const char *file, enum mandoclevel *level) @@ -341,8 +341,6 @@ enum mparset { typedef void (*mandocmsg)(enum mandocerr, enum mandoclevel, const char *, int, int, const char *); -typedef int (*mevt_open)(void *, const char *); -typedef void (*mevt_close)(void *, const char *); struct mparse; struct mdoc; @@ -352,8 +350,7 @@ __BEGIN_DECLS void mparse_free(struct mparse *); void mparse_reset(struct mparse *); -struct mparse *mparse_alloc(enum mparset, mevt_open, - mevt_close, +struct mparse *mparse_alloc(enum mparset, enum mandoclevel, mandocmsg, void *); enum mandoclevel mparse_readfd(struct mparse *, int, const char *); void mparse_result(struct mparse *, struct mdoc **, struct man **); @@ -58,8 +58,6 @@ struct mparse { int reparse_count; /* finite interp. stack */ mandocmsg mmsg; /* warning/error message handler */ void *arg; /* argument to mmsg */ - mevt_open evt_open; /* file-open event */ - mevt_close evt_close; /* file-close event */ const char *file; }; @@ -518,11 +516,6 @@ mparse_readfd_r(struct mparse *curp, int fd, const char *file, int re) { const char *svfile; - if ( ! (*curp->evt_open)(curp->arg, file)) { - curp->file_status = MANDOCLEVEL_SYSERR; - return; - } - if (-1 == fd) if (-1 == (fd = open(file, O_RDONLY, 0))) { perror(file); @@ -541,7 +534,6 @@ mparse_readfd_r(struct mparse *curp, int fd, const char *file, int re) if (STDIN_FILENO != fd && -1 == close(fd)) perror(file); - (*curp->evt_close)(curp->arg, file); curp->file = svfile; } @@ -554,8 +546,7 @@ mparse_readfd(struct mparse *curp, int fd, const char *file) } struct mparse * -mparse_alloc(enum mparset inttype, mevt_open eopen, - mevt_close eclose, enum mandoclevel wlevel, mandocmsg mmsg, void *arg) +mparse_alloc(enum mparset inttype, enum mandoclevel wlevel, mandocmsg mmsg, void *arg) { struct mparse *curp; @@ -565,8 +556,6 @@ mparse_alloc(enum mparset inttype, mevt_open eopen, curp->mmsg = mmsg; curp->arg = arg; curp->inttype = inttype; - curp->evt_open = eopen; - curp->evt_close = eclose; curp->roff = roff_alloc(&curp->regs, curp); return(curp); |