summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-12 12:10:55 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-12 12:10:55 +0000
commitc4604222386ea3939b89bb2b59c1bf69f126c06d (patch)
tree7cca59064db3c8b86048fe3557ecb3df5d117b45 /mdoc_validate.c
parent305a1c805ebbdca0c2e2de3a301a7f6759d2e200 (diff)
downloadmandoc-c4604222386ea3939b89bb2b59c1bf69f126c06d.tar.gz
mandoc-c4604222386ea3939b89bb2b59c1bf69f126c06d.tar.zst
mandoc-c4604222386ea3939b89bb2b59c1bf69f126c06d.zip
Moved `Bl -compact' into cached data. This allowed the removal of
scanning the argv list in print_bvspace(), and thus the parent pointer.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 62a126b3..b15fe397 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.96 2010/06/12 11:58:22 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.97 2010/06/12 12:10:55 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -532,7 +532,7 @@ pre_display(PRE_ARGS)
static int
pre_bl(PRE_ARGS)
{
- int i, width, offs, cmpt, dupl;
+ int i, width, offs, comp, dup;
enum mdoc_list lt;
if (MDOC_BLOCK != n->type) {
@@ -552,12 +552,12 @@ pre_bl(PRE_ARGS)
*/
assert(LIST__NONE == n->data.Bl.type);
- offs = width = cmpt = -1;
+ offs = width = -1;
/* LINTED */
for (i = 0; n->args && i < (int)n->args->argc; i++) {
lt = LIST__NONE;
- dupl = 0;
+ dup = comp = 0;
switch (n->args->argv[i].arg) {
/* Set list types. */
case (MDOC_Bullet):
@@ -595,27 +595,28 @@ pre_bl(PRE_ARGS)
break;
/* Set list arguments. */
case (MDOC_Compact):
- if (cmpt >= 0)
- dupl++;
- cmpt = i;
+ dup = n->data.Bl.comp;
+ comp = 1;
break;
case (MDOC_Width):
if (width >= 0)
- dupl++;
+ dup++;
width = i;
break;
case (MDOC_Offset):
if (offs >= 0)
- dupl++;
+ dup++;
offs = i;
break;
}
/* Check: duplicate auxiliary arguments. */
- if (dupl)
- if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGVREP))
- return(0);
+ if (dup && ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGVREP))
+ return(0);
+
+ if (comp && ! dup)
+ n->data.Bl.comp = comp;
/* Check: multiple list types. */
@@ -631,7 +632,7 @@ pre_bl(PRE_ARGS)
/* The list type should come first. */
if (n->data.Bl.type == LIST__NONE)
- if (width >= 0 || offs >= 0 || cmpt >= 0)
+ if (width >= 0 || offs >= 0 || n->data.Bl.comp)
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))
return(0);