projects
/
platform
/
upstream
/
isl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add isl_aff_mod_val
[platform/upstream/isl.git]
/
isl_id.c
diff --git
a/isl_id.c
b/isl_id.c
index
a3a2ea9
..
410218d
100644
(file)
--- a/
isl_id.c
+++ b/
isl_id.c
@@
-1,7
+1,7
@@
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
/*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
- * Use of this software is governed by the
GNU LGPLv2.1
license
+ * Use of this software is governed by the
MIT
license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
@@
-11,6
+11,11
@@
#include <isl_ctx_private.h>
#include <isl_id_private.h>
#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.
/* 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.
@@
-44,7
+49,7
@@
static __isl_give isl_id *id_alloc(isl_ctx *ctx, const char *name, void *user)
if (name && !copy)
return NULL;
if (name && !copy)
return NULL;
- id = isl_alloc_type(ctx, struct isl_id);
+ id = isl_
c
alloc_type(ctx, struct isl_id);
if (!id)
goto error;
if (!id)
goto error;
@@
-135,6
+140,19
@@
uint32_t isl_hash_id(uint32_t hash, __isl_keep isl_id *id)
return hash;
}
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.
*/
/* If the id has a negative refcount, then it is a static isl_id
* and should not be freed.
*/
@@
-159,6
+177,9
@@
void *isl_id_free(__isl_take isl_id *id)
else
isl_hash_table_remove(id->ctx, &id->ctx->id_table, entry);
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);
free((char *)id->name);
isl_ctx_deref(id->ctx);
free(id);