From ce0ad98d5799eeab84796f4d6a7ed2450a21010b Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 3 Jun 2010 13:44:36 +0000 Subject: Consolidated list processing to a single loop in mdoc_validate.c. This relieves having to repeat running over the argument list in mdoc_action.c and mdoc_validate.c. Default to LIST_item for type-less lists (groff technically doesn't do this: it just ignores the `It' lines altogether). Make MANDOC_LISTTYPE be a recoverable error. --- mdoc_html.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mdoc_html.c') diff --git a/mdoc_html.c b/mdoc_html.c index 894d605e..76a7fe8c 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.71 2010/05/31 10:28:04 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.72 2010/06/03 13:44:36 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -832,7 +832,6 @@ mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int comp, struct roffsu su; nn = n->parent->parent; - assert(nn->args); /* XXX: see notes in mdoc_it_pre(). */ @@ -1014,7 +1013,8 @@ mdoc_it_pre(MDOC_ARGS) /* Get width, offset, and compact arguments. */ - for (wp = -1, comp = i = 0; i < (int)bl->args->argc; i++) + wp = -1; + for (comp = i = 0; bl->args && i < (int)bl->args->argc; i++) switch (bl->args->argv[i].arg) { case (MDOC_Column): wp = i; /* Save for later. */ @@ -1322,7 +1322,7 @@ mdoc_bd_pre(MDOC_ARGS) SCALE_VS_INIT(&su, 0); type = comp = 0; - for (i = 0; i < (int)bl->args->argc; i++) + for (i = 0; bl->args && i < (int)bl->args->argc; i++) switch (bl->args->argv[i].arg) { case (MDOC_Offset): a2offs(bl->args->argv[i].value[0], &su); @@ -1997,8 +1997,7 @@ mdoc_bf_pre(MDOC_ARGS) else if ( ! strcmp("Li", n->head->child->string)) PAIR_CLASS_INIT(&tag[0], "lit"); } else { - assert(n->args); - for (i = 0; i < (int)n->args->argc; i++) + for (i = 0; n->args && i < (int)n->args->argc; i++) switch (n->args->argv[i].arg) { case (MDOC_Symbolic): PAIR_CLASS_INIT(&tag[0], "symb"); -- cgit v1.2.3