isl_mat_free: return NULL
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 9 Apr 2013 14:22:53 +0000 (16:22 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 12 Apr 2013 09:30:24 +0000 (11:30 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/mat.h
isl_mat.c

index 6ab3507..5ce9fad 100644 (file)
@@ -3178,7 +3178,7 @@ Matrices can be created, copied and freed using the following functions.
        __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
                unsigned n_row, unsigned n_col);
        __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
-       void isl_mat_free(__isl_take isl_mat *mat);
+       void *isl_mat_free(__isl_take isl_mat *mat);
 
 Note that the elements of a newly created matrix may have arbitrary values.
 The elements can be changed and inspected using the following functions.
index 3719004..13db7e2 100644 (file)
@@ -34,7 +34,7 @@ struct isl_mat *isl_mat_extend(struct isl_mat *mat,
 struct isl_mat *isl_mat_identity(struct isl_ctx *ctx, unsigned n_row);
 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
 struct isl_mat *isl_mat_cow(struct isl_mat *mat);
-void isl_mat_free(__isl_take isl_mat *mat);
+void *isl_mat_free(__isl_take isl_mat *mat);
 
 int isl_mat_rows(__isl_keep isl_mat *mat);
 int isl_mat_cols(__isl_keep isl_mat *mat);
index 2848e0a..5290dea 100644 (file)
--- a/isl_mat.c
+++ b/isl_mat.c
@@ -204,19 +204,21 @@ struct isl_mat *isl_mat_cow(struct isl_mat *mat)
        return mat2;
 }
 
-void isl_mat_free(struct isl_mat *mat)
+void *isl_mat_free(struct isl_mat *mat)
 {
        if (!mat)
-               return;
+               return NULL;
 
        if (--mat->ref > 0)
-               return;
+               return NULL;
 
        if (!ISL_F_ISSET(mat, ISL_MAT_BORROWED))
                isl_blk_free(mat->ctx, mat->block);
        isl_ctx_deref(mat->ctx);
        free(mat->row);
        free(mat);
+
+       return NULL;
 }
 
 int isl_mat_rows(__isl_keep isl_mat *mat)