add *list_copy
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 27 Apr 2011 14:57:14 +0000 (16:57 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 4 Jun 2011 11:19:22 +0000 (13:19 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/list.h
isl_list_templ.c

index 2002615..c2b394e 100644 (file)
@@ -2010,6 +2010,8 @@ Here we take lists of C<isl_set>s as an example.
        #include <isl/list.h>
        __isl_give isl_set_list *isl_set_list_alloc(
                isl_ctx *ctx, int n);
+       __isl_give isl_set_list *isl_set_list_copy(
+               __isl_keep isl_set_list *list);
        __isl_give isl_set_list *isl_set_list_add(
                __isl_take isl_set_list *list,
                __isl_take isl_set *el);
index dba1294..89fca4b 100644 (file)
@@ -21,6 +21,8 @@ struct isl_##EL;                                                      \
 struct isl_##EL##_list;                                                        \
 typedef struct isl_##EL##_list isl_##EL##_list;                                \
 __isl_give isl_##EL##_list *isl_##EL##_list_alloc(isl_ctx *ctx, int n);        \
+__isl_give isl_##EL##_list *isl_##EL##_list_copy(                      \
+       __isl_keep isl_##EL##_list *list);                              \
 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,                               \
index 0f901b3..c3a8b4f 100644 (file)
@@ -40,6 +40,15 @@ __isl_give LIST(EL) *FN(LIST(EL),alloc)(isl_ctx *ctx, int n)
        return list;
 }
 
+__isl_give LIST(EL) *FN(LIST(EL),copy)(__isl_keep LIST(EL) *list)
+{
+       if (!list)
+               return NULL;
+
+       list->ref++;
+       return list;
+}
+
 __isl_give LIST(EL) *FN(LIST(EL),add)(__isl_take LIST(EL) *list,
        __isl_take struct EL *el)
 {