From 68183e3516ca405d803db497157cd8246b9b8bad Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 30 Dec 2018 00:49:54 +0000 Subject: Cleanup, no functional change: The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters. --- mdoc_validate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index 3c773a52..c0469e88 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.365 2018/12/14 05:18:02 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.366 2018/12/30 00:49:55 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2018 Ingo Schwarze @@ -1952,7 +1952,7 @@ post_root(POST_ARGS) while (*arch != NULL && strcmp(*arch, mdoc->meta.arch)) arch++; if (*arch == NULL) { - n = mdoc->first->child; + n = mdoc->meta.first->child; while (n->tok != MDOC_Dt || n->child == NULL || n->child->next == NULL || @@ -1968,7 +1968,7 @@ post_root(POST_ARGS) /* Check that we begin with a proper `Sh'. */ - n = mdoc->first->child; + n = mdoc->meta.first->child; while (n != NULL && (n->type == ROFFT_COMMENT || (n->tok >= MDOC_Dd && -- cgit v1.2.3