From fbdecdad0cf27187c46c8c930a3cfd02be47f7ff Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 25 Jan 2014 23:18:10 +0000 Subject: generate_unique_id allows prefix --- src/common.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/common.c') 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); -- cgit 1.4.1-2-gfad0