about summary refs log tree commit diff stats
path: root/src/common.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-25 23:18:10 +0000
committerJames Booth <boothj5@gmail.com>2014-01-25 23:18:10 +0000
commitfbdecdad0cf27187c46c8c930a3cfd02be47f7ff (patch)
treeabea835fa6bfd611b46d535f8c4030b89092b591 /src/common.c
parente1aca3b1f6ff9cd6196bef280b29abe2dc8ef639 (diff)
downloadprofani-tty-fbdecdad0cf27187c46c8c930a3cfd02be47f7ff.tar.gz
generate_unique_id allows prefix
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c8
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);