summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-03 18:18:23 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-03 18:18:23 +0000
commit38cd8d7744122bc034230a06df16281613edf815 (patch)
tree065f9f734d56fc0a8646f89ce6568f40041486c3
parent679048c6d98227bb38e9acb5efb19a7051023fee (diff)
downloadmandoc-38cd8d7744122bc034230a06df16281613edf815.tar.gz
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--read.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/read.c b/read.c
index 5a887d60..7d60d51c 100644
--- a/read.c
+++ b/read.c
@@ -48,8 +48,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 */
@@ -830,13 +830,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;
}
@@ -845,8 +846,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);