From 0bbea1b848cacc7d35f6c63a0b8e16e37d1ae43f Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Tue, 6 Apr 2010 11:52:25 +0000 Subject: Cleaned up post_bl_head() and fixed erroneous reporting of child nodes. --- mdoc_validate.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index a60a5e99..cd9a2429 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.64 2010/04/06 11:28:17 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.65 2010/04/06 11:52:25 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -1095,22 +1095,23 @@ post_bl_head(POST_ARGS) { int i; const struct mdoc_node *n; + const struct mdoc_argv *a; n = mdoc->last->parent; assert(n->args); - for (i = 0; i < (int)n->args->argc; i++) - if (n->args->argv[i].arg == MDOC_Column) - break; - - if (i == (int)n->args->argc && n->nchild) - return(warn_count(mdoc, "==", 0, - "line arguments", n->nchild)); - - if (n->args->argv[i].sz && mdoc->last->child) - return(mdoc_nerr(mdoc, n, ECOLMIS)); + for (i = 0; i < (int)n->args->argc; i++) { + a = &n->args->argv[i]; + if (a->arg == MDOC_Column) { + if (a->sz && mdoc->last->nchild) + return(mdoc_nerr(mdoc, n, ECOLMIS)); + return(1); + } + } - return(1); + if (0 == (i = mdoc->last->nchild)) + return(1); + return(warn_count(mdoc, "==", 0, "line arguments", i)); } -- cgit v1.2.3-56-ge451