diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-02-03 18:18:23 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-02-03 18:18:23 +0000 |
commit | 0d727b1fc72e03c96b67adc84456ffbc3e44d6c4 (patch) | |
tree | aca330a1d179f1158a8b51cf9ad906930473614c /read.c | |
parent | b4d87d781d4abcb657896e5067c2b27264123837 (diff) | |
download | mandoc-0d727b1fc72e03c96b67adc84456ffbc3e44d6c4.tar.gz mandoc-0d727b1fc72e03c96b67adc84456ffbc3e44d6c4.tar.zst mandoc-0d727b1fc72e03c96b67adc84456ffbc3e44d6c4.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.
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.159 2017/02/03 17:56:59 schwarze Exp $ */ +/* $Id: read.c,v 1.160 2017/02/03 18:18:23 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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); |