summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-31 23:40:25 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-31 23:40:25 +0000
commitcf92b022147d19cfe09cf470b887681b4174ff0e (patch)
treefeab9337392e6811c2492f8e5ebd071c53cf597f /mdoc_validate.c
parent5790a921156fab714a8d9a5804ad1603664e8c80 (diff)
downloadmandoc-cf92b022147d19cfe09cf470b887681b4174ff0e.tar.gz
mandoc-cf92b022147d19cfe09cf470b887681b4174ff0e.tar.zst
mandoc-cf92b022147d19cfe09cf470b887681b4174ff0e.zip
Cleanup post_bl_head() to use enum mdoc_list (avoid traversing that
list). Reverted MANDOC_COLUMNS to be a bad-bad syntax error: we don't, and apparently never have, allowed mixing of -column syntaxes. This would have segfaulted if encountered.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index fd9af9cd..48e000c7 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.89 2010/05/31 23:10:51 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.90 2010/05/31 23:40:25 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -1024,20 +1024,23 @@ post_it(POST_ARGS)
static int
post_bl_head(POST_ARGS)
{
- int i;
- const struct mdoc_node *n;
- const struct mdoc_argv *a;
+ int i;
+ struct mdoc_node *n;
+ assert(mdoc->last->parent);
n = mdoc->last->parent;
- assert(n->args);
- 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_nmsg(mdoc, n, MANDOCERR_COLUMNS));
- return(1);
+ if (LIST_column == n->data.list) {
+ for (i = 0; i < (int)n->args->argc; i++)
+ if (MDOC_Column == n->args->argv[i].arg)
+ break;
+ assert(i < (int)n->args->argc);
+
+ if (n->args->argv[i].sz && mdoc->last->nchild) {
+ mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS);
+ return(0);
}
+ return(1);
}
if (0 == (i = mdoc->last->nchild))