From a25115afe89b89602c9224ef862c8ca1ec2973ce Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 27 Apr 2011 12:51:00 +0200 Subject: [PATCH] add *list_n_* Signed-off-by: Sven Verdoolaege --- doc/user.pod | 1 + include/isl/list.h | 1 + isl_list_templ.c | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index 3e389c0..e7e8980 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -2025,6 +2025,7 @@ Lists can be inspected using the following functions. #include isl_ctx *isl_set_list_get_ctx(__isl_keep isl_set_list *list); + int isl_set_list_n_set(__isl_keep isl_set_list *list); int isl_set_list_foreach(__isl_keep isl_set_list *list, int (*fn)(__isl_take struct isl_set *el, void *user), void *user); diff --git a/include/isl/list.h b/include/isl/list.h index ce251b4..bbbc16d 100644 --- a/include/isl/list.h +++ b/include/isl/list.h @@ -28,6 +28,7 @@ void isl_##EL##_list_free(__isl_take isl_##EL##_list *list); \ __isl_give isl_##EL##_list *isl_##EL##_list_add( \ __isl_take isl_##EL##_list *list, \ __isl_take struct isl_##EL *el); \ +int isl_##EL##_list_n_##EL(__isl_keep isl_##EL##_list *list); \ int isl_##EL##_list_foreach(__isl_keep isl_##EL##_list *list, \ int (*fn)(__isl_take struct isl_##EL *el, void *user), void *user); diff --git a/isl_list_templ.c b/isl_list_templ.c index bd94023..1e56158 100644 --- a/isl_list_templ.c +++ b/isl_list_templ.c @@ -85,6 +85,11 @@ void FN(LIST(EL),free)(__isl_take LIST(EL) *list) free(list); } +int FN(FN(LIST(EL),n),BASE)(__isl_keep LIST(EL) *list) +{ + return list ? list->n : 0; +} + int FN(LIST(EL),foreach)(__isl_keep LIST(EL) *list, int (*fn)(__isl_take EL *el, void *user), void *user) { -- 2.7.4