diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2018-12-31 04:55:46 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2018-12-31 04:55:46 +0000 |
commit | c0cea6817b9d23d8e5e4a752fc1dff8dfb604cdc (patch) | |
tree | 8583999131b10c7f020825880396b50813e04620 /roff.c | |
parent | 0cd2663fe9e76ba0ad357a566dc3416eccab70e5 (diff) | |
download | mandoc-c0cea6817b9d23d8e5e4a752fc1dff8dfb604cdc.tar.gz |
Cleanup, minus 15 LOC, no functional change:
Simplify the way the man(7) and mdoc(7) validators are called.
Reset the parser state with a common function before calling them.
There is no need to again reset the parser state afterwards,
the parsers are no longer used after validation.
This allows getting rid of man_node_validate() and mdoc_node_validate()
as separate functions.
Diffstat (limited to 'roff.c')
-rw-r--r-- | roff.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -819,18 +819,25 @@ roff_man_free1(struct roff_man *man) free(man->meta.sodest); } +void +roff_state_reset(struct roff_man *man) +{ + man->last = man->meta.first; + man->last_es = NULL; + man->flags = 0; + man->lastsec = man->lastnamed = SEC_NONE; + man->next = ROFF_NEXT_CHILD; + roff_setreg(man->roff, "nS", 0, '='); +} + static void roff_man_alloc1(struct roff_man *man) { memset(&man->meta, 0, sizeof(man->meta)); man->meta.first = mandoc_calloc(1, sizeof(*man->meta.first)); man->meta.first->type = ROFFT_ROOT; - man->last = man->meta.first; - man->last_es = NULL; - man->flags = 0; man->meta.macroset = MACROSET_NONE; - man->lastsec = man->lastnamed = SEC_NONE; - man->next = ROFF_NEXT_CHILD; + roff_state_reset(man); } void |