=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mandocdb.c,v retrieving revision 1.194 retrieving revision 1.195 diff -c -r1.194 -r1.195 *** src/usr.bin/mandoc/mandocdb.c 2017/03/03 13:41:28 1.194 --- src/usr.bin/mandoc/mandocdb.c 2017/04/24 23:06:09 1.195 *************** *** 1,4 **** ! /* $OpenBSD: mandocdb.c,v 1.194 2017/03/03 13:41:28 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011-2017 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: mandocdb.c,v 1.195 2017/04/24 23:06:09 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011-2017 Ingo Schwarze *************** *** 168,175 **** static struct ohash strings; /* table of all strings */ static uint64_t name_mask; ! static const struct mdoc_handler mdocs[MDOC_MAX] = { ! { NULL, 0, 0 }, /* Ap */ { NULL, 0, NODE_NOPRT }, /* Dd */ { NULL, 0, NODE_NOPRT }, /* Dt */ { NULL, 0, NODE_NOPRT }, /* Os */ --- 168,174 ---- static struct ohash strings; /* table of all strings */ static uint64_t name_mask; ! static const struct mdoc_handler __mdocs[MDOC_MAX - MDOC_Dd] = { { NULL, 0, NODE_NOPRT }, /* Dd */ { NULL, 0, NODE_NOPRT }, /* Dt */ { NULL, 0, NODE_NOPRT }, /* Os */ *************** *** 185,190 **** --- 184,190 ---- { NULL, 0, 0 }, /* It */ { NULL, 0, 0 }, /* Ad */ { NULL, TYPE_An, 0 }, /* An */ + { NULL, 0, 0 }, /* Ap */ { NULL, TYPE_Ar, 0 }, /* Ar */ { NULL, TYPE_Cd, 0 }, /* Cd */ { NULL, TYPE_Cm, 0 }, /* Cm */ *************** *** 293,298 **** --- 293,299 ---- { NULL, 0, 0 }, /* Ta */ { NULL, 0, 0 }, /* ll */ }; + static const struct mdoc_handler *const mdocs = __mdocs - MDOC_Dd; int *************** *** 1505,1513 **** const struct roff_node *n) { ! assert(NULL != n); ! for (n = n->child; NULL != n; n = n->next) { ! if (n->flags & mdocs[n->tok].taboo) continue; switch (n->type) { case ROFFT_ELEM: --- 1506,1513 ---- const struct roff_node *n) { ! for (n = n->child; n != NULL; n = n->next) { ! if (n->tok == TOKEN_NONE || n->flags & mdocs[n->tok].taboo) continue; switch (n->type) { case ROFFT_ELEM: *************** *** 1515,1529 **** case ROFFT_HEAD: case ROFFT_BODY: case ROFFT_TAIL: ! if (NULL != mdocs[n->tok].fp) ! if (0 == (*mdocs[n->tok].fp)(mpage, meta, n)) ! break; if (mdocs[n->tok].mask) putmdockey(mpage, n->child, mdocs[n->tok].mask, mdocs[n->tok].taboo); break; default: - assert(n->type != ROFFT_ROOT); continue; } if (NULL != n->child) --- 1515,1528 ---- case ROFFT_HEAD: case ROFFT_BODY: case ROFFT_TAIL: ! if (mdocs[n->tok].fp != NULL && ! (*mdocs[n->tok].fp)(mpage, meta, n) == 0) ! break; if (mdocs[n->tok].mask) putmdockey(mpage, n->child, mdocs[n->tok].mask, mdocs[n->tok].taboo); break; default: continue; } if (NULL != n->child)