Lines Matching +full:- +full:- +full:user
2 * Copyright 2008-2009 Katholieke Universiteit Leuven
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
22 * The user should never get a hold on this isl_id.
25 .ref = -1,
28 .user = NULL
33 return id ? id->ctx : NULL; in isl_id_get_ctx()
38 return id ? id->user : NULL; in isl_id_get_user()
43 return id ? id->name : NULL; in isl_id_get_name()
46 static __isl_give isl_id *id_alloc(isl_ctx *ctx, const char *name, void *user) in id_alloc() argument
57 id->ctx = ctx; in id_alloc()
58 isl_ctx_ref(id->ctx); in id_alloc()
59 id->ref = 1; in id_alloc()
60 id->name = copy; in id_alloc()
61 id->user = user; in id_alloc()
63 id->hash = isl_hash_init(); in id_alloc()
65 id->hash = isl_hash_string(id->hash, name); in id_alloc()
67 id->hash = isl_hash_builtin(id->hash, user); in id_alloc()
77 return id ? id->hash : 0; in isl_id_get_hash()
82 void *user; member
90 if (id->user != nu->user) in isl_id_has_name_and_user()
92 if (id->name == nu->name) in isl_id_has_name_and_user()
94 if (!id->name || !nu->name) in isl_id_has_name_and_user()
97 return isl_bool_ok(!strcmp(id->name, nu->name)); in isl_id_has_name_and_user()
100 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx, const char *name, void *user) in isl_id_alloc() argument
104 struct isl_name_and_user nu = { name, user }; in isl_id_alloc()
113 id_hash = isl_hash_builtin(id_hash, user); in isl_id_alloc()
114 entry = isl_hash_table_find(ctx, &ctx->id_table, id_hash, in isl_id_alloc()
118 if (entry->data) in isl_id_alloc()
119 return isl_id_copy(entry->data); in isl_id_alloc()
120 entry->data = id_alloc(ctx, name, user); in isl_id_alloc()
121 if (!entry->data) in isl_id_alloc()
122 ctx->id_table.n--; in isl_id_alloc()
123 return entry->data; in isl_id_alloc()
134 if (id->ref < 0) in isl_id_copy()
137 id->ref++; in isl_id_copy()
144 * the user pointers as a last resort since these pointer values
152 return -1; in isl_id_cmp()
155 if (!id1->name != !id2->name) in isl_id_cmp()
156 return !id1->name - !id2->name; in isl_id_cmp()
157 if (id1->name) { in isl_id_cmp()
158 int cmp = strcmp(id1->name, id2->name); in isl_id_cmp()
162 if (id1->user < id2->user) in isl_id_cmp()
163 return -1; in isl_id_cmp()
176 isl_hash_hash(hash, id->hash); in isl_hash_id()
184 void (*free_user)(void *user)) in isl_id_set_free_user() argument
189 id->free_user = free_user; in isl_id_set_free_user()
197 void (*isl_id_get_free_user(__isl_keep isl_id *id))(void *user) in isl_id_get_free_user()
201 return id->free_user; in isl_id_get_free_user()
214 if (id->ref < 0) in isl_id_free()
217 if (--id->ref > 0) in isl_id_free()
220 entry = isl_hash_table_find(id->ctx, &id->ctx->id_table, id->hash, in isl_id_free()
225 isl_die(id->ctx, isl_error_unknown, in isl_id_free()
228 isl_hash_table_remove(id->ctx, &id->ctx->id_table, entry); in isl_id_free()
230 if (id->free_user) in isl_id_free()
231 id->free_user(id->user); in isl_id_free()
233 free((char *)id->name); in isl_id_free()
234 isl_ctx_deref(id->ctx); in isl_id_free()
246 if (id->name) in isl_printer_print_id()
247 p = isl_printer_print_str(p, id->name); in isl_printer_print_id()
248 if (id->user) { in isl_printer_print_id()
250 snprintf(buffer, sizeof(buffer), "@%p", id->user); in isl_printer_print_id()