diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-07-01 22:56:17 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-07-01 22:56:17 +0000 |
commit | 68ee78dc7731e4adb30a4b384fa171f2116f8561 (patch) | |
tree | b091c0f021833dae369e100a2ca9257ce6d2fa9e /mdoc_action.c | |
parent | 0bae01a379ba9702c03dfcf16874c3ec9beaa711 (diff) | |
download | mandoc-68ee78dc7731e4adb30a4b384fa171f2116f8561.tar.gz |
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_action.c')
-rw-r--r-- | mdoc_action.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/mdoc_action.c b/mdoc_action.c index 0c84a87f..48a248cd 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -696,7 +696,7 @@ post_bl_tagwidth(POST_ARGS) n->args->argv[i].value[0] = mandoc_strdup(buf); /* Set our width! */ - n->data.Bl.width = n->args->argv[i].value[0]; + n->data.Bl->width = n->args->argv[i].value[0]; return(1); } @@ -719,9 +719,9 @@ post_bl_width(POST_ARGS) * the macro's width as set in share/tmac/mdoc/doc-common. */ - if (0 == strcmp(n->data.Bl.width, "Ds")) + if (0 == strcmp(n->data.Bl->width, "Ds")) width = 6; - else if (MDOC_MAX == (tok = mdoc_hash_find(n->data.Bl.width))) + else if (MDOC_MAX == (tok = mdoc_hash_find(n->data.Bl->width))) return(1); else if (0 == (width = mdoc_macro2len(tok))) return(mdoc_nmsg(m, n, MANDOCERR_BADWIDTH)); @@ -741,7 +741,7 @@ post_bl_width(POST_ARGS) n->args->argv[i].value[0] = mandoc_strdup(buf); /* Set our width! */ - n->data.Bl.width = n->args->argv[i].value[0]; + n->data.Bl->width = n->args->argv[i].value[0]; return(1); } @@ -757,7 +757,7 @@ post_bl_head(POST_ARGS) int i, c; struct mdoc_node *np, *nn, *nnp; - if (LIST_column != n->data.Bl.type) + if (LIST_column != n->data.Bl->type) return(1); else if (NULL == n->child) return(1); @@ -799,8 +799,6 @@ post_bl_head(POST_ARGS) static int post_bl(POST_ARGS) { - struct mdoc_node *nn; - const char *ww; if (MDOC_HEAD == n->type) return(post_bl_head(m, n)); @@ -815,28 +813,16 @@ post_bl(POST_ARGS) * rewritten into real lengths). */ - ww = n->data.Bl.width; - - if (LIST_tag == n->data.Bl.type && NULL == n->data.Bl.width) { + if (LIST_tag == n->data.Bl->type && NULL == n->data.Bl->width) { if ( ! post_bl_tagwidth(m, n)) return(0); - } else if (NULL != n->data.Bl.width) { + } else if (NULL != n->data.Bl->width) { if ( ! post_bl_width(m, n)) return(0); } else return(1); - assert(n->data.Bl.width); - - /* If it has changed, propogate new width to children. */ - - if (ww == n->data.Bl.width) - return(1); - - for (nn = n->child; nn; nn = nn->next) - if (MDOC_Bl == nn->tok) - nn->data.Bl.width = n->data.Bl.width; - + assert(n->data.Bl->width); return(1); } @@ -967,9 +953,10 @@ pre_bd(PRE_ARGS) if (MDOC_BODY != n->type) return(1); - if (DISP_literal == n->data.Bd.type) + assert(n->data.Bd); + if (DISP_literal == n->data.Bd->type) m->flags |= MDOC_LITERAL; - if (DISP_unfilled == n->data.Bd.type) + if (DISP_unfilled == n->data.Bd->type) m->flags |= MDOC_LITERAL; return(1); |