summaryrefslogtreecommitdiffstats
path: root/libversion/gitversion.cpp.in
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-05-15 09:28:16 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-05-15 09:34:17 (GMT)
commit10787eed95266bb1a13c892fe4cf5a695dac1559 (patch)
tree3267c7bc4580d4de7ec5797b5658038ad53e3941 /libversion/gitversion.cpp.in
parent12843822b09f0aa3f426387986354d9e1303e41e (diff)
downloadDoxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.zip
Doxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.tar.gz
Doxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.tar.bz2
Refactoring
- Makes doxycfg library more self contained - renames _doxygen library to doxymain - Modernizes Debug implementation - Moves Doxygen::runningTime into Debug - Moves full version string to libversion - Removed mentioning of file version in messages (when FILE_VERSION_FILTER is used) - Move substitute functions into QCString
Diffstat (limited to 'libversion/gitversion.cpp.in')
-rw-r--r--libversion/gitversion.cpp.in17
1 files changed, 12 insertions, 5 deletions
diff --git a/libversion/gitversion.cpp.in b/libversion/gitversion.cpp.in
index 164b50b..50ce1d2 100644
--- a/libversion/gitversion.cpp.in
+++ b/libversion/gitversion.cpp.in
@@ -6,11 +6,18 @@
* - No git information is present (no .git directory)
* in those cases clear the gitVersionString (would have string GIT-NOTFOUND).
*/
-char *getGitVersion(void)
+const char *getGitVersion(void)
{
- static char gitVersionString[100];
- strcpy(gitVersionString,"@GIT_HEAD_SHA1@");
- strcat(gitVersionString,!strcmp("@GIT_IS_DIRTY@","true")?"*":"");
- if (!strcmp("@GIT_HEAD_SHA1@", "GIT-NOTFOUND")) gitVersionString[0] = '\0';
+#define BUF_SIZE 100
+ static char gitVersionString[BUF_SIZE];
+ static bool init = false;
+ if (!init)
+ {
+ strncpy(gitVersionString,"@GIT_HEAD_SHA1@",BUF_SIZE);
+ strncat(gitVersionString,!strcmp("@GIT_IS_DIRTY@","true")?"*":"",BUF_SIZE);
+ if (!strcmp("@GIT_HEAD_SHA1@", "GIT-NOTFOUND")) gitVersionString[0] = '\0';
+ gitVersionString[BUF_SIZE-1]='\0';
+ init = true;
+ }
return gitVersionString;
}