From 7a6eb8920bdea2ecc151b308352b2a98699b2350 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 14 Dec 2018 05:18:02 +0000 Subject: 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. --- mandoc.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'mandoc.c') diff --git a/mandoc.c b/mandoc.c index 5476fb41..0ea64761 100644 --- a/mandoc.c +++ b/mandoc.c @@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.108 2018/10/25 01:32:40 schwarze Exp $ */ +/* $Id: mandoc.c,v 1.109 2018/12/14 05:18:02 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze @@ -467,7 +467,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) /* Quoted argument without a closing quote. */ if (1 == quoted) - mandoc_msg(MANDOCERR_ARG_QUOTE, parse, ln, *pos, NULL); + mandoc_msg(MANDOCERR_ARG_QUOTE, ln, *pos, NULL); /* NUL-terminate this argument and move to the next one. */ if (pairs) @@ -481,7 +481,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) *cpp = cp; if ('\0' == *cp && (white || ' ' == cp[-1])) - mandoc_msg(MANDOCERR_SPACE_EOL, parse, ln, *pos, NULL); + mandoc_msg(MANDOCERR_SPACE_EOL, ln, *pos, NULL); return start; } @@ -562,7 +562,7 @@ mandoc_normdate(struct roff_man *man, char *in, int ln, int pos) /* No date specified: use today's date. */ if (in == NULL || *in == '\0' || strcmp(in, "$" "Mdocdate$") == 0) { - mandoc_msg(MANDOCERR_DATE_MISSING, man->parse, ln, pos, NULL); + mandoc_msg(MANDOCERR_DATE_MISSING, ln, pos, NULL); return time2a(time(NULL)); } @@ -572,23 +572,20 @@ mandoc_normdate(struct roff_man *man, char *in, int ln, int pos) a2time(&t, "%b %d, %Y", in)) { cp = time2a(t); if (t > time(NULL) + 86400) - mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse, - ln, pos, cp); + mandoc_msg(MANDOCERR_DATE_FUTURE, ln, pos, "%s", cp); else if (*in != '$' && strcmp(in, cp) != 0) - mandoc_msg(MANDOCERR_DATE_NORM, man->parse, - ln, pos, cp); + mandoc_msg(MANDOCERR_DATE_NORM, ln, pos, "%s", cp); return cp; } /* In man(7), do not warn about the legacy format. */ if (a2time(&t, "%Y-%m-%d", in) == 0) - mandoc_msg(MANDOCERR_DATE_BAD, man->parse, ln, pos, in); + mandoc_msg(MANDOCERR_DATE_BAD, ln, pos, "%s", in); else if (t > time(NULL) + 86400) - mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse, ln, pos, in); + mandoc_msg(MANDOCERR_DATE_FUTURE, ln, pos, "%s", in); else if (man->macroset == MACROSET_MDOC) - mandoc_vmsg(MANDOCERR_DATE_LEGACY, man->parse, - ln, pos, "Dd %s", in); + mandoc_msg(MANDOCERR_DATE_LEGACY, ln, pos, "Dd %s", in); /* Use any non-mdoc(7) date verbatim. */ -- cgit v1.2.3-56-ge451