-/* $Id: mdoc_validate.c,v 1.358 2018/04/11 17:11:13 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.362 2018/08/17 20:33:38 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
static void post_xr(POST_ARGS);
static void post_xx(POST_ARGS);
-static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] = {
+static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = {
post_dd, /* Dd */
post_dt, /* Dt */
post_os, /* Os */
NULL, /* %U */
NULL, /* Ta */
};
-static const v_post *const mdoc_valids = __mdoc_valids - MDOC_Dd;
#define RSORD_MAX 14 /* Number of `Rs' blocks. */
}
assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
- p = mdoc_valids + n->tok;
+ p = mdoc_valids + (n->tok - MDOC_Dd);
if (*p)
(*p)(mdoc);
if (mdoc->last == n)
isalpha((unsigned char)cp[-3]) :
np != NULL &&
np->type == ROFFT_TEXT &&
- np->string != '\0' &&
+ *np->string != '\0' &&
isalpha((unsigned char)np->string[
strlen(np->string) - 1])) ||
- (cp[2] != '\0' ?
+ (cp[1] != '\0' && cp[2] != '\0' ?
isalpha((unsigned char)cp[2]) :
nn != NULL &&
nn->type == ROFFT_TEXT &&
- nn->string != '\0' &&
isalpha((unsigned char)*nn->string))) {
mandoc_msg(MANDOCERR_DASHDASH, mdoc->parse,
ln, pos + (int)(cp - p) - 1, NULL);
while (n != NULL &&
(n->type == ROFFT_COMMENT ||
(n->tok >= MDOC_Dd &&
- mdoc_macros[n->tok].flags & MDOC_PROLOGUE)))
+ mdoc_macro(n->tok)->flags & MDOC_PROLOGUE)))
n = n->next;
if (n == NULL)