From 7a0a11ba25ac6c0a9d31fc795b8e8b00d612f5dc Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 3 Jul 2011 19:54:11 +0200 Subject: [PATCH] add private isl_*_list_dup Signed-off-by: Sven Verdoolaege --- isl_list_templ.c | 16 ++++++++++++++++ isl_list_templ.h | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/isl_list_templ.c b/isl_list_templ.c index 9504e6e..0bf8294 100644 --- a/isl_list_templ.c +++ b/isl_list_templ.c @@ -54,6 +54,22 @@ __isl_give LIST(EL) *FN(LIST(EL),copy)(__isl_keep LIST(EL) *list) return list; } +__isl_give LIST(EL) *FN(LIST(EL),dup)(__isl_keep LIST(EL) *list) +{ + int i; + LIST(EL) *dup; + + if (!list) + return NULL; + + dup = FN(LIST(EL),alloc)(FN(LIST(EL),get_ctx)(list), list->n); + if (!dup) + return NULL; + for (i = 0; i < list->n; ++i) + dup = FN(LIST(EL),add)(dup, FN(EL,copy)(list->p[i])); + return dup; +} + __isl_give LIST(EL) *FN(LIST(EL),add)(__isl_take LIST(EL) *list, __isl_take struct EL *el) { diff --git a/isl_list_templ.h b/isl_list_templ.h index 6ceb966..a959980 100644 --- a/isl_list_templ.h +++ b/isl_list_templ.h @@ -12,3 +12,12 @@ struct LIST(EL) { size_t size; struct EL *p[1]; }; + +#define ISL_DECLARE_LIST_PRIVATE(EL) \ +__isl_give isl_##EL##_list *isl_##EL##_list_dup( \ + __isl_keep isl_##EL##_list *list); + +ISL_DECLARE_LIST_PRIVATE(basic_set) +ISL_DECLARE_LIST_PRIVATE(set) +ISL_DECLARE_LIST_PRIVATE(aff) +ISL_DECLARE_LIST_PRIVATE(band) -- 2.7.4