* mandoc: Initializers for file-scope static variables should be
@ 2019-01-10 6:29 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-01-10 6:29 UTC (permalink / raw)
To: source
Log Message:
-----------
Initializers for file-scope static variables should be compile-time
constants, and while stderr is a compile-time constant in OpenBSD,
Kelvin Sherlock <ksherlock at gmail dot com> reports that it isn't
on some other systems, for example on FreeBSD or Linux.
So do the initialization by calling mandoc_msg_setoutfile()
from main() instead.
Modified Files:
--------------
mandoc:
main.c
mandoc_msg.c
Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/main.c,v
retrieving revision 1.316
retrieving revision 1.317
diff -Lmain.c -Lmain.c -u -p -r1.316 -r1.317
--- main.c
+++ main.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -148,6 +148,7 @@ main(int argc, char *argv[])
setprogname(progname);
#endif
+ mandoc_msg_setoutfile(stderr);
if (strncmp(progname, "mandocdb", 8) == 0 ||
strcmp(progname, BINM_MAKEWHATIS) == 0)
return mandocdb(argc, argv);
Index: mandoc_msg.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc_msg.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lmandoc_msg.c -Lmandoc_msg.c -u -p -r1.4 -r1.5
--- mandoc_msg.c
+++ mandoc_msg.c
@@ -240,7 +240,7 @@ static const char *const type_message[MA
"ignoring macro in table",
};
-static FILE *fileptr = stderr;
+static FILE *fileptr = NULL;
static const char *filename = NULL;
static enum mandocerr min_type = MANDOCERR_MAX;
static enum mandoclevel rc = MANDOCLEVEL_OK;
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-01-10 6:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10 6:29 mandoc: Initializers for file-scope static variables should be schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).