This will be useful for static isl_ids that are not supposed to change.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
return entry->data;
}
+/* If the id has a negative refcount, then it is a static isl_id
+ * which should not be changed.
+ */
__isl_give isl_id *isl_id_copy(isl_id *id)
{
if (!id)
return NULL;
+ if (id->ref < 0)
+ return id;
+
id->ref++;
return id;
}
return hash;
}
+/* If the id has a negative refcount, then it is a static isl_id
+ * and should not be freed.
+ */
void *isl_id_free(__isl_take isl_id *id)
{
struct isl_hash_table_entry *entry;
if (!id)
return NULL;
+ if (id->ref < 0)
+ return NULL;
+
if (--id->ref > 0)
return NULL;