#include <isl_ctx_private.h>
#include <isl_id_private.h>
+#undef BASE
+#define BASE id
+
+#include <isl_list_templ.c>
+
/* A special, static isl_id to use as domains (and ranges)
* of sets and parameters domains.
* The user should never get a hold on this isl_id.
if (name && !copy)
return NULL;
- id = isl_alloc_type(ctx, struct isl_id);
+ id = isl_calloc_type(ctx, struct isl_id);
if (!id)
goto error;
return hash;
}
+/* Replace the free_user callback by "free_user".
+ */
+__isl_give isl_id *isl_id_set_free_user(__isl_take isl_id *id,
+ __isl_give void (*free_user)(void *user))
+{
+ if (!id)
+ return NULL;
+
+ id->free_user = free_user;
+
+ return id;
+}
+
/* If the id has a negative refcount, then it is a static isl_id
* and should not be freed.
*/
else
isl_hash_table_remove(id->ctx, &id->ctx->id_table, entry);
+ if (id->free_user)
+ id->free_user(id->user);
+
free((char *)id->name);
isl_ctx_deref(id->ctx);
free(id);