From ae495b6ef2036704da0450c0bf91dd2b034deaf8 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 9 Apr 2013 16:22:53 +0200 Subject: [PATCH] isl_mat_free: return NULL Signed-off-by: Sven Verdoolaege --- doc/user.pod | 2 +- include/isl/mat.h | 2 +- isl_mat.c | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/user.pod b/doc/user.pod index 6ab35070..5ce9fadf 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -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. diff --git a/include/isl/mat.h b/include/isl/mat.h index 3719004c..13db7e26 100644 --- a/include/isl/mat.h +++ b/include/isl/mat.h @@ -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); diff --git a/isl_mat.c b/isl_mat.c index 2848e0a5..5290deab 100644 --- 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) -- 2.11.4.GIT