From 2001002c2f58c1ecbab8b64fb35f3fdfe27acb15 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 1 Jun 2012 17:26:40 +0200 Subject: [PATCH] add pet_scop_alloc It will be convenient to have pet_scops only being allocated from a single place. Signed-off-by: Sven Verdoolaege --- parse.c | 2 +- scop.c | 7 ++++++- scop.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/parse.c b/parse.c index b239efa..859015b 100644 --- a/parse.c +++ b/parse.c @@ -383,7 +383,7 @@ static struct pet_scop *extract_scop(isl_ctx *ctx, yaml_document_t *document, isl_die(ctx, isl_error_invalid, "expecting mapping", return NULL); - scop = isl_calloc_type(ctx, struct pet_scop); + scop = pet_scop_alloc(ctx); if (!scop) return NULL; diff --git a/scop.c b/scop.c index 51dcada..d71ea5b 100644 --- a/scop.c +++ b/scop.c @@ -646,6 +646,11 @@ void pet_array_dump(struct pet_array *array) array->live_out ? "live-out" : ""); } +struct pet_scop *pet_scop_alloc(isl_ctx *ctx) +{ + return isl_calloc_type(ctx, struct pet_scop); +} + /* Construct a pet_scop with room for n statements. */ static struct pet_scop *scop_alloc(isl_ctx *ctx, int n) @@ -653,7 +658,7 @@ static struct pet_scop *scop_alloc(isl_ctx *ctx, int n) isl_space *space; struct pet_scop *scop; - scop = isl_calloc_type(ctx, struct pet_scop); + scop = pet_scop_alloc(ctx); if (!scop) return NULL; diff --git a/scop.h b/scop.h index 9db8429..cf9efec 100644 --- a/scop.h +++ b/scop.h @@ -43,6 +43,7 @@ void *pet_array_free(struct pet_array *array); struct pet_stmt *pet_stmt_prefix(struct pet_stmt *stmt, int pos); struct pet_scop *pet_scop_from_pet_stmt(isl_ctx *ctx, struct pet_stmt *stmt); +struct pet_scop *pet_scop_alloc(isl_ctx *ctx); struct pet_scop *pet_scop_empty(isl_ctx *ctx); struct pet_scop *pet_scop_add(isl_ctx *ctx, struct pet_scop *scop1, struct pet_scop *scop2); -- 2.11.4.GIT