summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-04 22:08:22 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2020-03-05 11:07:32 +0100
commit8a0eecfd5e4aaeddd025d64e32697692f532874d (patch)
treed46d7d272177d1d8a3cbd5b7d5d0e90f2821bba3 /core
parent9f8d593a150566c39548e0fdfe9c392ae939ff31 (diff)
downloadsubsurface-8a0eecfd5e4aaeddd025d64e32697692f532874d.tar.gz
cleanup: make version_printed variable static and local to function
The version_printed variable is used to print version information only once. It was a global variable, but never used outside of its function. Therefore, move it into the function and make it static. Since this is a plain old datatype (POD), it makes no no difference whatsoever whether the static variable is in block scope or not. Indeed, it is initialized in the data segment). Well, we are in C mode and therefore everything has to be POD by definition. I tested this on gcc and clang. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r--core/subsurfacestartup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index db18c34ce..85235b9f7 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -128,9 +128,9 @@ const char *monthname(int mon)
*/
bool imported = false;
-bool version_printed = false;
void print_version()
{
+ static bool version_printed = false;
if (version_printed)
return;
printf("Subsurface v%s,\n", subsurface_git_version());