Add helper function to create version string
And remove all the duplicate code. Depending on the situation prof_get_version() will return: * 0.13.1 * 0.13.1dev * 0.13.1dev.master.69d8c1f9
This commit is contained in:
21
src/common.c
21
src/common.c
@@ -62,6 +62,10 @@
|
||||
#include "log.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
#include "gitversion.h"
|
||||
#endif
|
||||
|
||||
struct curl_data_t
|
||||
{
|
||||
char* buffer;
|
||||
@@ -688,3 +692,20 @@ glib_hash_table_free(GHashTable* hash_table)
|
||||
g_hash_table_remove_all(hash_table);
|
||||
g_hash_table_unref(hash_table);
|
||||
}
|
||||
|
||||
/* build profanity version string.
|
||||
* example: 0.13.1dev.master.69d8c1f9
|
||||
*/
|
||||
gchar*
|
||||
prof_get_version(void)
|
||||
{
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
return g_strdup_printf("%sdev.%s.%s", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION);
|
||||
#else
|
||||
return g_strdup_printf("%sdev", PACKAGE_VERSION);
|
||||
#endif
|
||||
} else {
|
||||
return g_strdup_printf("%s", PACKAGE_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user