diff options
author | James Booth <boothj5@gmail.com> | 2014-01-25 23:18:10 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-01-25 23:18:10 +0000 |
commit | fbdecdad0cf27187c46c8c930a3cfd02be47f7ff (patch) | |
tree | abea835fa6bfd611b46d535f8c4030b89092b591 /src/common.c | |
parent | e1aca3b1f6ff9cd6196bef280b29abe2dc8ef639 (diff) | |
download | profani-tty-fbdecdad0cf27187c46c8c930a3cfd02be47f7ff.tar.gz |
generate_unique_id allows prefix
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common.c b/src/common.c index c8367592..5cce121a 100644 --- a/src/common.c +++ b/src/common.c @@ -372,14 +372,18 @@ xdg_get_data_home(void) } char * -get_unique_id(void) +generate_unique_id(char *prefix) { static unsigned long unique_id; char *result = NULL; GString *result_str = g_string_new(""); unique_id++; - g_string_printf(result_str, "prof%lu", unique_id); + if (prefix != NULL) { + g_string_printf(result_str, "prof_%s_%lu", prefix, unique_id); + } else { + g_string_printf(result_str, "prof_%lu", unique_id); + } result = result_str->str; g_string_free(result_str, FALSE); |