From 77701b3b198a9b7a6a77dc7597752613b1c476ba Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Tue, 4 Oct 2016 11:46:09 +0200 Subject: [PATCH] let isl_point_free return a NULL pointer This makes isl_point_free consistent with the other isl_*_free functions, which already return NULL pointers for convenience. Signed-off-by: Tobias Grosser Signed-off-by: Sven Verdoolaege --- doc/user.pod | 3 ++- include/isl/point.h | 2 +- isl_point.c | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/user.pod b/doc/user.pod index aa0475f5..92e12c37 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -2362,7 +2362,8 @@ Points can be copied or freed using __isl_give isl_point *isl_point_copy( __isl_keep isl_point *pnt); - void isl_point_free(__isl_take isl_point *pnt); + __isl_null isl_point *isl_point_free( + __isl_take isl_point *pnt); A singleton set can be created from a point using diff --git a/include/isl/point.h b/include/isl/point.h index c928f9ac..97c3c46f 100644 --- a/include/isl/point.h +++ b/include/isl/point.h @@ -17,7 +17,7 @@ __isl_give isl_space *isl_point_get_space(__isl_keep isl_point *pnt); __isl_give isl_point *isl_point_zero(__isl_take isl_space *dim); __isl_give isl_point *isl_point_copy(__isl_keep isl_point *pnt); -void isl_point_free(__isl_take isl_point *pnt); +__isl_null isl_point *isl_point_free(__isl_take isl_point *pnt); __isl_give isl_val *isl_point_get_coordinate_val(__isl_keep isl_point *pnt, enum isl_dim_type type, int pos); diff --git a/isl_point.c b/isl_point.c index c25b76fb..48534edd 100644 --- a/isl_point.c +++ b/isl_point.c @@ -103,17 +103,18 @@ __isl_give isl_point *isl_point_copy(__isl_keep isl_point *pnt) return pnt; } -void isl_point_free(__isl_take isl_point *pnt) +__isl_null isl_point *isl_point_free(__isl_take isl_point *pnt) { if (!pnt) - return; + return NULL; if (--pnt->ref > 0) - return; + return NULL; isl_space_free(pnt->dim); isl_vec_free(pnt->vec); free(pnt); + return NULL; } __isl_give isl_point *isl_point_void(__isl_take isl_space *dim) -- 2.11.4.GIT