diff options
author | 2017-02-03 18:18:08 +0000 | |
---|---|---|
committer | 2017-02-03 18:18:08 +0000 | |
commit | 77f3ec4f61160976a3bc0c73267d81948dac1738 (patch) | |
tree | 7bae6d99233f937d819d889e690bc964de2060bb | |
parent | If an application parses multiple files with mparse_readfd(3) but (diff) | |
download | wireguard-openbsd-77f3ec4f61160976a3bc0c73267d81948dac1738.tar.xz wireguard-openbsd-77f3ec4f61160976a3bc0c73267d81948dac1738.zip |
Minor cleanup, no functional change:
We always have a roff parser, so mparse_free() does not need to check
for existence before freeing it.
Also arrange code in struct mparse, mparse_reset(), and mparse_free()
in the same order for readability.
-rw-r--r-- | usr.bin/mandoc/read.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 6784dad50d3..4acf098a0db 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.132 2017/02/03 17:55:36 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.133 2017/02/03 18:18:08 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -43,8 +43,8 @@ #define REPARSE_LIMIT 1000 struct mparse { - struct roff_man *man; /* man parser */ struct roff *roff; /* roff parser (!NULL) */ + struct roff_man *man; /* man parser */ char *sodest; /* filename pointed to by .so */ const char *file; /* filename of current input file */ struct buf *primary; /* buffer currently being parsed */ @@ -811,13 +811,14 @@ mparse_reset(struct mparse *curp) { roff_reset(curp->roff); roff_man_reset(curp->man); + + free(curp->sodest); + curp->sodest = NULL; + if (curp->secondary) curp->secondary->sz = 0; curp->file_status = MANDOCLEVEL_OK; - - free(curp->sodest); - curp->sodest = NULL; curp->gzip = 0; } @@ -826,8 +827,7 @@ mparse_free(struct mparse *curp) { roff_man_free(curp->man); - if (curp->roff) - roff_free(curp->roff); + roff_free(curp->roff); if (curp->secondary) free(curp->secondary->buf); |