aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-08-17 20:33:37 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-08-17 20:33:37 +0000
commitde2a1122a661dd4bd4004854891d44e87d63c6c2 (patch)
tree79380a193e1374fd7e4b697152b0b7aea304ddf8 /mdoc.c
parent3f485a7ff74c3707363ed47362ccc8a7855b0f58 (diff)
downloadmandoc-de2a1122a661dd4bd4004854891d44e87d63c6c2.tar.gz
mandoc-de2a1122a661dd4bd4004854891d44e87d63c6c2.tar.zst
mandoc-de2a1122a661dd4bd4004854891d44e87d63c6c2.zip
Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard. Robert Elz <kre at munnari dot oz dot au> pointed out i wasn't quite done yet.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/mdoc.c b/mdoc.c
index 71803531..8ea579b6 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,7 +1,7 @@
-/* $Id: mdoc.c,v 1.268 2017/08/11 16:56:21 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.269 2018/08/17 20:33:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -80,13 +80,6 @@ mdoc_parseln(struct roff_man *mdoc, int ln, char *buf, int offs)
}
void
-mdoc_macro(MACRO_PROT_ARGS)
-{
- assert(tok >= MDOC_Dd && tok < MDOC_MAX);
- (*mdoc_macros[tok].fp)(mdoc, tok, line, ppos, pos, buf);
-}
-
-void
mdoc_tail_alloc(struct roff_man *mdoc, int line, int pos, enum roff_tok tok)
{
struct roff_node *p;
@@ -196,7 +189,8 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
(n->parent != NULL && n->parent->tok == MDOC_Bl &&
n->parent->norm->Bl.type == LIST_column)) {
mdoc->flags |= MDOC_FREECOL;
- mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf);
+ (*mdoc_macro(MDOC_It)->fp)(mdoc, MDOC_It,
+ line, offs, &offs, buf);
return 1;
}
@@ -378,7 +372,7 @@ mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs)
n = mdoc->last;
if (n == NULL || tok == MDOC_It || tok == MDOC_El) {
- mdoc_macro(mdoc, tok, ln, sv, &offs, buf);
+ (*mdoc_macro(tok)->fp)(mdoc, tok, ln, sv, &offs, buf);
return 1;
}
@@ -394,13 +388,13 @@ mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs)
(n->parent != NULL && n->parent->tok == MDOC_Bl &&
n->parent->norm->Bl.type == LIST_column)) {
mdoc->flags |= MDOC_FREECOL;
- mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf);
+ (*mdoc_macro(MDOC_It)->fp)(mdoc, MDOC_It, ln, sv, &sv, buf);
return 1;
}
/* Normal processing of a macro. */
- mdoc_macro(mdoc, tok, ln, sv, &offs, buf);
+ (*mdoc_macro(tok)->fp)(mdoc, tok, ln, sv, &offs, buf);
/* In quick mode (for mandocdb), abort after the NAME section. */