summaryrefslogtreecommitdiff
path: root/isl_list_templ.c
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2011-04-16 14:55:10 +0200
committerSven Verdoolaege <skimo@kotnet.org>2011-06-04 13:19:23 +0200
commit88f7a78a974d4f6689835b82d5e3cc008667aff0 (patch)
tree39926dbc9838f752b6d3ebb183ba1afda6c4fcfe /isl_list_templ.c
parent0a2cf69b577640926186fbf62c0d9c2759236270 (diff)
downloadisl-88f7a78a974d4f6689835b82d5e3cc008667aff0.tar.gz
isl-88f7a78a974d4f6689835b82d5e3cc008667aff0.tar.bz2
isl-88f7a78a974d4f6689835b82d5e3cc008667aff0.zip
add *_list_foreach
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Diffstat (limited to 'isl_list_templ.c')
-rw-r--r--isl_list_templ.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/isl_list_templ.c b/isl_list_templ.c
index 4fb89659..bd940236 100644
--- a/isl_list_templ.c
+++ b/isl_list_templ.c
@@ -84,3 +84,22 @@ void FN(LIST(EL),free)(__isl_take LIST(EL) *list)
FN(EL,free)(list->p[i]);
free(list);
}
+
+int FN(LIST(EL),foreach)(__isl_keep LIST(EL) *list,
+ int (*fn)(__isl_take EL *el, void *user), void *user)
+{
+ int i;
+
+ if (!list)
+ return -1;
+
+ for (i = 0; i < list->n; ++i) {
+ EL *el = FN(EL,copy(list->p[i]));
+ if (!el)
+ return -1;
+ if (fn(el, user) < 0)
+ return -1;
+ }
+
+ return 0;
+}