From 969858aeecaa06945deb4fe2339e066219db92d5 Mon Sep 17 00:00:00 2001 From: schwarze Date: Tue, 19 Jul 2016 16:22:34 +0000 Subject: [PATCH] Since the mdoc/man parser unification, the parser is always allocated in mparse_alloc(), so delete all the curp->man == NULL checks. Triggered by a patch from Christos Zoulas suggesting to add yet another such check. --- usr.bin/mandoc/read.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 100965e22ca..65ecff72194 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.123 2016/07/10 13:33:50 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.124 2016/07/19 16:22:34 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -284,13 +284,6 @@ choose_parser(struct mparse *curp) } } - if (curp->man == NULL) { - curp->man = roff_man_alloc(curp->roff, curp, curp->defos, - curp->options & MPARSE_QUICK ? 1 : 0); - curp->man->macroset = MACROSET_MAN; - curp->man->first->tok = TOKEN_NONE; - } - if (format == MPARSE_MDOC) { mdoc_hash_init(); curp->man->macroset = MACROSET_MDOC; @@ -555,15 +548,7 @@ rerun: break; } - /* - * If input parsers have not been allocated, do so now. - * We keep these instanced between parsers, but set them - * locally per parse routine since we can use different - * parsers with each one. - */ - - if (curp->man == NULL || - curp->man->macroset == MACROSET_NONE) + if (curp->man->macroset == MACROSET_NONE) choose_parser(curp); /* @@ -673,10 +658,6 @@ read_whole_file(struct mparse *curp, const char *file, int fd, static void mparse_end(struct mparse *curp) { - - if (curp->man == NULL && curp->sodest == NULL) - curp->man = roff_man_alloc(curp->roff, curp, curp->defos, - curp->options & MPARSE_QUICK ? 1 : 0); if (curp->man->macroset == MACROSET_NONE) curp->man->macroset = MACROSET_MAN; if (curp->man->macroset == MACROSET_MDOC) @@ -817,11 +798,8 @@ mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg, void mparse_reset(struct mparse *curp) { - roff_reset(curp->roff); - - if (curp->man != NULL) - roff_man_reset(curp->man); + roff_man_reset(curp->man); if (curp->secondary) curp->secondary->sz = 0; -- 2.20.1