aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-01 22:56:17 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-01 22:56:17 +0000
commitf813f185be40796eacad83ea709b1ba0374a67c1 (patch)
tree1e588554fee5273076627d525b9303ba919d21e4 /mdoc_html.c
parente552a5cef0219ea63fb9521677e1a8a05ad35727 (diff)
downloadmandoc-f813f185be40796eacad83ea709b1ba0374a67c1.tar.gz
mandoc-f813f185be40796eacad83ea709b1ba0374a67c1.tar.zst
mandoc-f813f185be40796eacad83ea709b1ba0374a67c1.zip
Make struct_bl and struct_bd into pointers. This removes the need to do
copying on internals after modification. Even more importantly, if an ENDBODY token is provided, it would have been impossible for post-change copying of the data to take place in the BLOCK. This allows it to happen by dint of pointers. Also did some bikeshedding in mdoc_term.c: checking against enum type and explicitly casting to the "post" function to void. This is for my own readability.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 1b521c6a..1277a765 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.89 2010/07/01 14:34:03 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.90 2010/07/01 22:56:17 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -1038,11 +1038,12 @@ mdoc_it_pre(MDOC_ARGS)
SCALE_HS_INIT(&offs, 0);
- type = bl->data.Bl.type;
- comp = bl->data.Bl.comp;
+ assert(bl->data.Bl);
+ type = bl->data.Bl->type;
+ comp = bl->data.Bl->comp;
- if (bl->data.Bl.offs)
- a2offs(bl->data.Bl.offs, &offs);
+ if (bl->data.Bl->offs)
+ a2offs(bl->data.Bl->offs, &offs);
switch (type) {
case (LIST_enum):
@@ -1059,8 +1060,8 @@ mdoc_it_pre(MDOC_ARGS)
break;
}
- if (bl->data.Bl.width)
- a2width(bl->data.Bl.width, &width);
+ if (bl->data.Bl->width)
+ a2width(bl->data.Bl->width, &width);
wp = -1;
for (i = 0; bl->args && i < (int)bl->args->argc; i++)
@@ -1118,7 +1119,8 @@ mdoc_bl_pre(MDOC_ARGS)
return(0);
if (MDOC_BLOCK != n->type)
return(1);
- if (LIST_enum != n->data.Bl.type)
+ assert(n->data.Bl);
+ if (LIST_enum != n->data.Bl->type)
return(1);
ord = malloc(sizeof(struct ord));
@@ -1142,7 +1144,7 @@ mdoc_bl_post(MDOC_ARGS)
if (MDOC_BLOCK != n->type)
return;
- if (LIST_enum != n->data.Bl.type)
+ if (LIST_enum != n->data.Bl->type)
return;
ord = h->ords.head;
@@ -1357,10 +1359,11 @@ mdoc_bd_pre(MDOC_ARGS)
SCALE_VS_INIT(&su, 0);
- if (n->data.Bd.offs)
- a2offs(n->data.Bd.offs, &su);
+ assert(n->data.Bd);
+ if (n->data.Bd->offs)
+ a2offs(n->data.Bd->offs, &su);
- comp = n->data.Bd.comp;
+ comp = n->data.Bd->comp;
/* FIXME: -centered, etc. formatting. */
/* FIXME: does not respect -offset ??? */
@@ -1387,8 +1390,8 @@ mdoc_bd_pre(MDOC_ARGS)
return(1);
}
- if (DISP_unfilled != n->data.Bd.type &&
- DISP_literal != n->data.Bd.type)
+ if (DISP_unfilled != n->data.Bd->type &&
+ DISP_literal != n->data.Bd->type)
return(1);
PAIR_CLASS_INIT(&tag[0], "lit");