diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2018-08-17 20:33:37 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2018-08-17 20:33:37 +0000 |
commit | a55868d2cb7c07237689f307d3a55b33b257de09 (patch) | |
tree | 6e622b38423ae091b6a8a02b0843ea2bfb7958b4 /mdoc.c | |
parent | f6077aba4f0b9ece3ceff820c0c651d148df1a37 (diff) | |
download | mandoc-a55868d2cb7c07237689f307d3a55b33b257de09.tar.gz |
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.c | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -1,7 +1,7 @@ /* $Id$ */ /* * 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. */ |