#define ISL_F_CLR(p, f) ISL_FL_CLR((p)->flags, f)
#define ISL_F_ISSET(p, f) ISL_FL_ISSET((p)->flags, f)
-#define isl_alloc(ctx,type,size) (type *)malloc(size)
-#define isl_calloc(ctx,type,size) (type *)calloc(1, size)
-#define isl_realloc(ctx,ptr,type,size) (type *)realloc(ptr,size)
+/* isl_check_ctx() checks at compile time if 'ctx' is of type 'isl_ctx *' and
+ * returns the value of 'expr'. It is used to ensure, that always an isl_ctx is
+ * passed to the following macros, even if they currently do not use it.
+ */
+#define isl_check_ctx(ctx, expr) (ctx != (isl_ctx *) 0) ? expr : expr
+
+#define isl_alloc(ctx,type,size) isl_check_ctx(ctx, (type *)malloc(size))
+#define isl_calloc(ctx,type,size) isl_check_ctx(ctx, \
+ (type *)calloc(1, size))
+#define isl_realloc(ctx,ptr,type,size) isl_check_ctx(ctx, \
+ (type *)realloc(ptr,size))
#define isl_alloc_type(ctx,type) isl_alloc(ctx,type,sizeof(type))
#define isl_calloc_type(ctx,type) isl_calloc(ctx,type,sizeof(type))
#define isl_realloc_type(ctx,ptr,type) isl_realloc(ctx,ptr,type,sizeof(type))
#define isl_alloc_array(ctx,type,n) isl_alloc(ctx,type,(n)*sizeof(type))
-#define isl_calloc_array(ctx,type,n) (type *)calloc(n, sizeof(type))
+#define isl_calloc_array(ctx,type,n) isl_check_ctx(ctx,\
+ (type *)calloc(n, sizeof(type)))
#define isl_realloc_array(ctx,ptr,type,n) \
isl_realloc(ctx,ptr,type,(n)*sizeof(type))
int bits;
unsigned total = isl_basic_map_total_dim(bmap);
isl_int sum;
+ isl_ctx *ctx;
if (!bmap || bmap->n_ineq <= 1)
return bmap;
size = round_up(4 * (bmap->n_ineq+1) / 3 - 1);
bits = ffs(size) - 1;
+ ctx = isl_basic_map_get_ctx(bmap);
index = isl_calloc_array(ctx, isl_int **, size);
if (!index)
return bmap;
isl_int ***index;
int bits;
int k, h, l;
+ isl_ctx *ctx;
if (!bset)
return NULL;
size = round_up(4 * (context->n_ineq+1) / 3 - 1);
bits = ffs(size) - 1;
+ ctx = isl_basic_set_get_ctx(bset);
index = isl_calloc_array(ctx, isl_int **, size);
if (!index)
return bset;