aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-12-14 05:18:02 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-12-14 05:18:02 +0000
commit7a6eb8920bdea2ecc151b308352b2a98699b2350 (patch)
tree9860a766930f3997c413b0f0aecd6ba815b80f25 /man.c
parent0ef6626fcc16277d2fefb32e1830dfba3df5defd (diff)
downloadmandoc-7a6eb8920bdea2ecc151b308352b2a98699b2350.tar.gz
mandoc-7a6eb8920bdea2ecc151b308352b2a98699b2350.tar.zst
mandoc-7a6eb8920bdea2ecc151b308352b2a98699b2350.zip
Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used. While here, rename mandoc_vmsg() to mandoc_msg() and retire the old version: There is really no point in having another function merely to save "%s" in a few places. Minus 140 lines of code.
Diffstat (limited to 'man.c')
-rw-r--r--man.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/man.c b/man.c
index e36dc833..b62f3ed1 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.180 2018/08/26 16:21:23 schwarze Exp $ */
+/* $Id: man.c,v 1.181 2018/12/14 05:18:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -122,8 +122,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs)
if (buf[i] == '\0') {
if (man->flags & (MAN_ELINE | MAN_BLINE)) {
- mandoc_msg(MANDOCERR_BLK_BLANK, man->parse,
- line, 0, NULL);
+ mandoc_msg(MANDOCERR_BLK_BLANK, line, 0, NULL);
return 1;
}
if (man->last->tok == MAN_SH || man->last->tok == MAN_SS)
@@ -148,8 +147,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs)
if (' ' == buf[i - 1] || '\t' == buf[i - 1]) {
if (i > 1 && '\\' != buf[i - 2])
- mandoc_msg(MANDOCERR_SPACE_EOL, man->parse,
- line, i - 1, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, line, i - 1, NULL);
for (--i; i && ' ' == buf[i]; i--)
/* Spin back to non-space. */ ;
@@ -194,8 +192,7 @@ man_pmacro(struct roff_man *man, int ln, char *buf, int offs)
if (sz > 0 && sz < 4)
tok = roffhash_find(man->manmac, buf + ppos, sz);
if (tok == TOKEN_NONE) {
- mandoc_msg(MANDOCERR_MACRO, man->parse,
- ln, ppos, buf + ppos - 1);
+ mandoc_msg(MANDOCERR_MACRO, ln, ppos, "%s", buf + ppos - 1);
return 1;
}
@@ -225,8 +222,7 @@ man_pmacro(struct roff_man *man, int ln, char *buf, int offs)
*/
if (buf[offs] == '\0' && buf[offs - 1] == ' ')
- mandoc_msg(MANDOCERR_SPACE_EOL, man->parse,
- ln, offs - 1, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, ln, offs - 1, NULL);
/*
* Some macros break next-line scopes; otherwise, remember
@@ -299,9 +295,8 @@ man_breakscope(struct roff_man *man, int tok)
== MAN_NSCOPED)
n = n->parent;
- mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
- n->line, n->pos, "%s breaks %s",
- roff_name[tok], roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_LINE, n->line, n->pos,
+ "%s breaks %s", roff_name[tok], roff_name[n->tok]);
roff_node_delete(man, n);
man->flags &= ~MAN_ELINE;
@@ -341,9 +336,8 @@ man_breakscope(struct roff_man *man, int tok)
assert(n->type == ROFFT_BLOCK);
assert(man_macro(n->tok)->flags & MAN_BSCOPED);
- mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
- n->line, n->pos, "%s breaks %s",
- roff_name[tok], roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_LINE, n->line, n->pos,
+ "%s breaks %s", roff_name[tok], roff_name[n->tok]);
roff_node_delete(man, n);
man->flags &= ~MAN_BLINE;
@@ -358,16 +352,14 @@ man_state(struct roff_man *man, struct roff_node *n)
case MAN_nf:
case MAN_EX:
if (man->flags & MAN_LITERAL && ! (n->flags & NODE_VALID))
- mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
- n->line, n->pos, "nf");
+ mandoc_msg(MANDOCERR_NF_SKIP, n->line, n->pos, "nf");
man->flags |= MAN_LITERAL;
break;
case MAN_fi:
case MAN_EE:
if ( ! (man->flags & MAN_LITERAL) &&
! (n->flags & NODE_VALID))
- mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
- n->line, n->pos, "fi");
+ mandoc_msg(MANDOCERR_FI_SKIP, n->line, n->pos, "fi");
man->flags &= ~MAN_LITERAL;
break;
default: