diff options
author | Sven Verdoolaege <skimo@kotnet.org> | 2011-07-25 08:52:14 +0200 |
---|---|---|
committer | Sven Verdoolaege <skimo@kotnet.org> | 2011-07-28 16:41:23 +0200 |
commit | 78168765d3d7e49ef96f35eef7b4cb07015e6198 (patch) | |
tree | 0897ff369f280d8b9df5dd03e415a0a108681f47 /isl_list_templ.c | |
parent | fb240915dac74d3360936b44e66f459f9b878b57 (diff) | |
download | isl-78168765d3d7e49ef96f35eef7b4cb07015e6198.tar.gz isl-78168765d3d7e49ef96f35eef7b4cb07015e6198.tar.bz2 isl-78168765d3d7e49ef96f35eef7b4cb07015e6198.zip |
add isl_*_list_concat
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Diffstat (limited to 'isl_list_templ.c')
-rw-r--r-- | isl_list_templ.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/isl_list_templ.c b/isl_list_templ.c index 7eb50afa..9aa4351b 100644 --- a/isl_list_templ.c +++ b/isl_list_templ.c @@ -155,6 +155,32 @@ error: return NULL; } +__isl_give LIST(EL) *FN(LIST(EL),concat)(__isl_take LIST(EL) *list1, + __isl_take LIST(EL) *list2) +{ + int i; + isl_ctx *ctx; + LIST(EL) *res; + + if (!list1 || !list2) + goto error; + + ctx = FN(LIST(EL),get_ctx)(list1); + res = FN(LIST(EL),alloc)(ctx, list1->n + list2->n); + for (i = 0; i < list1->n; ++i) + res = FN(LIST(EL),add)(res, FN(EL,copy)(list1->p[i])); + for (i = 0; i < list2->n; ++i) + res = FN(LIST(EL),add)(res, FN(EL,copy)(list2->p[i])); + + FN(LIST(EL),free)(list1); + FN(LIST(EL),free)(list2); + return res; +error: + FN(LIST(EL),free)(list1); + FN(LIST(EL),free)(list2); + return NULL; +} + __isl_give isl_printer *CAT(isl_printer_print_,LIST(BASE))( __isl_take isl_printer *p, __isl_keep LIST(EL) *list) { |