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>
This commit is contained in:
Berthold Stoeger 2020-03-04 22:08:22 +01:00 committed by bstoeger
parent 9f8d593a15
commit 8a0eecfd5e

View file

@ -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());