From 8a0eecfd5e4aaeddd025d64e32697692f532874d Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 4 Mar 2020 22:08:22 +0100 Subject: 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 --- core/subsurfacestartup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') 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()); -- cgit v1.2.3-70-g09d2