=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.367 retrieving revision 1.368 diff -u -p -r1.367 -r1.368 --- mandoc/mdoc_term.c 2018/04/11 17:11:13 1.367 +++ mandoc/mdoc_term.c 2018/08/17 20:33:38 1.368 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.367 2018/04/11 17:11:13 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.368 2018/08/17 20:33:38 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2018 Ingo Schwarze @@ -47,7 +47,7 @@ struct termpair { const struct roff_meta *meta, \ struct roff_node *n -struct termact { +struct mdoc_term_act { int (*pre)(DECL_ARGS); void (*post)(DECL_ARGS); }; @@ -124,7 +124,7 @@ static int termp_vt_pre(DECL_ARGS); static int termp_xr_pre(DECL_ARGS); static int termp_xx_pre(DECL_ARGS); -static const struct termact __termacts[MDOC_MAX - MDOC_Dd] = { +static const struct mdoc_term_act mdoc_term_acts[MDOC_MAX - MDOC_Dd] = { { NULL, NULL }, /* Dd */ { NULL, NULL }, /* Dt */ { NULL, NULL }, /* Os */ @@ -246,7 +246,6 @@ static const struct termact __termacts[MDOC_MAX - MDOC { NULL, termp____post }, /* %U */ { NULL, NULL }, /* Ta */ }; -static const struct termact *const termacts = __termacts - MDOC_Dd; static int fn_prio; @@ -310,9 +309,10 @@ print_mdoc_nodelist(DECL_ARGS) static void print_mdoc_node(DECL_ARGS) { - int chld; + const struct mdoc_term_act *act; struct termpair npair; size_t offset, rmargin; + int chld; if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) return; @@ -370,10 +370,10 @@ print_mdoc_node(DECL_ARGS) return; } assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); - if (termacts[n->tok].pre != NULL && + act = mdoc_term_acts + (n->tok - MDOC_Dd); + if (act->pre != NULL && (n->end == ENDBODY_NOT || n->child != NULL)) - chld = (*termacts[n->tok].pre) - (p, &npair, meta, n); + chld = (*act->pre)(p, &npair, meta, n); break; } @@ -391,9 +391,9 @@ print_mdoc_node(DECL_ARGS) case ROFFT_EQN: break; default: - if (termacts[n->tok].post == NULL || n->flags & NODE_ENDED) + if (act->post == NULL || n->flags & NODE_ENDED) break; - (void)(*termacts[n->tok].post)(p, &npair, meta, n); + (void)(*act->post)(p, &npair, meta, n); /* * Explicit end tokens not only call the post