summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-04 21:59:30 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-04 21:59:30 +0000
commitb8b9e11a867466342dc730ff378f7456de5a4680 (patch)
tree99282f4ab9682a6ac1b301cf328097398b20d5f8 /mdoc_validate.c
parent5dbcea4594d8b16bf100320bc68f4bc0892bda30 (diff)
downloadmandoc-b8b9e11a867466342dc730ff378f7456de5a4680.tar.gz
Cache column sizes and char pointer into mdoc_bl. Finally get rid of
the loops here and there to track down the MDOC_Column arguments.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index dce10ed0..bb0f58e8 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -647,8 +647,16 @@ pre_bl(PRE_ARGS)
/* Assign list type. */
- if (LIST__NONE != lt && n->data.Bl->type == LIST__NONE)
+ if (LIST__NONE != lt && n->data.Bl->type == LIST__NONE) {
n->data.Bl->type = lt;
+ /* Set column information, too. */
+ if (LIST_column == lt) {
+ n->data.Bl->ncols =
+ n->args->argv[i].sz;
+ n->data.Bl->cols = (const char **)
+ n->args->argv[i].value;
+ }
+ }
/* The list type should come first. */
@@ -1150,14 +1158,8 @@ post_it(POST_ARGS)
return(0);
break;
case (LIST_column):
- cols = -1;
- for (i = 0; i < (int)n->args->argc; i++)
- if (MDOC_Column == n->args->argv[i].arg) {
- cols = (int)n->args->argv[i].sz;
- break;
- }
+ cols = (int)n->data.Bl->ncols;
- assert(-1 != cols);
assert(NULL == mdoc->last->head->child);
if (NULL == mdoc->last->body->child)
@@ -1197,12 +1199,7 @@ post_bl_head(POST_ARGS)
n = mdoc->last->parent;
if (LIST_column == n->data.Bl->type) {
- 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) {
+ if (n->data.Bl->ncols && mdoc->last->nchild) {
mdoc_nmsg(mdoc, n, MANDOCERR_COLUMNS);
return(0);
}