summaryrefslogtreecommitdiffhomepage
path: root/ir/ident
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2008-04-03 00:01:24 +0200
committerMatthias Braun <matze@braunis.de>2008-04-03 00:01:24 +0200
commit4ad9a0aefb83cc34a4cd05907f934d1e50de780a (patch)
treeaa992dc68db57f2c8575f44b3828a29044e2f4db /ir/ident
parent8b64e5dcfdf27f385fba00193b99c224992a08f2 (diff)
helper function for creating unique identifiers
[r19078]
Diffstat (limited to 'ir/ident')
-rw-r--r--ir/ident/ident.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ir/ident/ident.c b/ir/ident/ident.c
index af6bc04..d239034 100644
--- a/ir/ident/ident.c
+++ b/ir/ident/ident.c
@@ -337,6 +337,16 @@ int id_contains_char(ident *id, char c)
return strchr(get_id_str(id), c) != NULL;
}
+ident *id_unique(const char *tag)
+{
+ static unsigned unique_id = 0;
+ char buf[256];
+
+ snprintf(buf, sizeof(buf), tag, unique_id);
+ unique_id++;
+ return new_id_from_str(buf);
+}
+
#ifdef FIRM_ENABLE_WCHAR
ident *new_id_from_wcs (const wchar_t *str)