From 2f0e9ab1ef271132b8b7b1af25e23ac7bb0720c8 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 29 Nov 2016 16:51:58 +0100 Subject: refcount: return pointer to the structure instead of a counter There are no real users of the counter. It was thought of a handy tool to track and debug refcounting, but it is not used at all. Some parts of the code would benefit from a pointer getting returned instead. BUG: 1399780 Change-Id: I97e52c48420fed61be942ea27ff4849b803eed12 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/15971 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Xavier Hernandez Reviewed-by: Kaleb KEITHLEY --- libglusterfs/src/refcount.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libglusterfs/src/refcount.h') diff --git a/libglusterfs/src/refcount.h b/libglusterfs/src/refcount.h index e850e6389ae..db9432acbbc 100644 --- a/libglusterfs/src/refcount.h +++ b/libglusterfs/src/refcount.h @@ -42,7 +42,7 @@ typedef struct _gf_ref_t gf_ref_t; * * @return: greater then 0 when a reference was taken, 0 when not */ -unsigned int +void * _gf_ref_get (gf_ref_t *ref); /* _gf_ref_put -- decrease the refcount @@ -50,7 +50,7 @@ _gf_ref_get (gf_ref_t *ref); * @return: greater then 0 when there are still references, 0 when cleanup * should be done, gf_ref_release_t is called on cleanup */ -unsigned int +void _gf_ref_put (gf_ref_t *ref); /* _gf_ref_init -- initalize an embedded refcount object @@ -84,20 +84,20 @@ _gf_ref_init (gf_ref_t *ref, gf_ref_release_t release, void *data); * * Sets the refcount to 1. */ -#define GF_REF_INIT(p, d) _gf_ref_init (&p->_ref, d, p) +#define GF_REF_INIT(p, d) _gf_ref_init (&(p)->_ref, d, p) /* GF_REF_GET -- increase the refcount of a GF_REF_DECL structure * * @return: greater then 0 when a reference was taken, 0 when not */ -#define GF_REF_GET(p) _gf_ref_get (&p->_ref) +#define GF_REF_GET(p) _gf_ref_get (&(p)->_ref) /* GF_REF_PUT -- decrease the refcount of a GF_REF_DECL structure * * @return: greater then 0 when there are still references, 0 when cleanup * should be done, gf_ref_release_t is called on cleanup */ -#define GF_REF_PUT(p) _gf_ref_put (&p->_ref) +#define GF_REF_PUT(p) _gf_ref_put (&(p)->_ref) #endif /* _REFCOUNT_H */ -- cgit