From 2b38493a355220eb46d7c95067fbfd54be72b026 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 16 Aug 2018 10:53:02 +0200 Subject: [PATCH] isl_map.c: basic_map_init: use isl_basic_map_peek_space This reduces the dependence on the internal representation. Signed-off-by: Sven Verdoolaege --- isl_map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/isl_map.c b/isl_map.c index 898a5125..103df2ac 100644 --- a/isl_map.c +++ b/isl_map.c @@ -1144,11 +1144,16 @@ static __isl_give isl_basic_map *basic_map_init(isl_ctx *ctx, unsigned n_eq, unsigned n_ineq) { int i; - size_t row_size = 1 + isl_space_dim(bmap->dim, isl_dim_all) + extra; + isl_space *space = isl_basic_map_peek_space(bmap); + unsigned n_var = isl_space_dim(space, isl_dim_all); + size_t row_size = 1 + n_var + extra; bmap->ctx = ctx; isl_ctx_ref(ctx); + if (!space) + return isl_basic_map_free(bmap); + bmap->block = isl_blk_alloc(ctx, (n_ineq + n_eq) * row_size); if (isl_blk_is_error(bmap->block)) goto error; -- 2.11.4.GIT