[master] 78c243894 polish: use TAKE_OBJ_NOTNULL

Nils Goroll nils.goroll at uplex.de
Tue Jun 26 08:42:10 UTC 2018


commit 78c243894bed86b3c0637fda49d47f3d33fc72b0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Jun 26 10:39:21 2018 +0200

    polish: use TAKE_OBJ_NOTNULL

diff --git a/lib/libvmod_directors/shard_dir.c b/lib/libvmod_directors/shard_dir.c
index 61a14bf75..bfc86f45a 100644
--- a/lib/libvmod_directors/shard_dir.c
+++ b/lib/libvmod_directors/shard_dir.c
@@ -250,11 +250,7 @@ sharddir_delete(struct sharddir **sharddp)
 {
 	struct sharddir *shardd;
 
-	AN(sharddp);
-	shardd = *sharddp;
-	*sharddp = NULL;
-
-	CHECK_OBJ_NOTNULL(shardd, SHARDDIR_MAGIC);
+	TAKE_OBJ_NOTNULL(shardd, sharddp, SHARDDIR_MAGIC);
 	shardcfg_delete(shardd);
 	AZ(pthread_rwlock_destroy(&shardd->mtx));
 	FREE_OBJ(shardd);
diff --git a/lib/libvmod_directors/vmod_shard.c b/lib/libvmod_directors/vmod_shard.c
index 6a28721b1..90430a066 100644
--- a/lib/libvmod_directors/vmod_shard.c
+++ b/lib/libvmod_directors/vmod_shard.c
@@ -259,10 +259,9 @@ vmod_shard__init(VRT_CTX, struct vmod_directors_shard **vshardp,
 VCL_VOID v_matchproto_(td_directors_shard__fini)
 vmod_shard__fini(struct vmod_directors_shard **vshardp)
 {
-	struct vmod_directors_shard *vshard = *vshardp;
+	struct vmod_directors_shard *vshard;
 
-	*vshardp = NULL;
-	CHECK_OBJ_NOTNULL(vshard, VMOD_SHARD_SHARD_MAGIC);
+	TAKE_OBJ_NOTNULL(vshard, vshardp, VMOD_SHARD_SHARD_MAGIC);
 	sharddir_delete(&vshard->shardd);
 	VRT_DelDirector(&vshard->dir);
 	FREE_OBJ(vshard);
@@ -778,12 +777,11 @@ vmod_shard_param__init(VRT_CTX,
 VCL_VOID v_matchproto_(td_directors_shard_param__fini)
 vmod_shard_param__fini(struct vmod_directors_shard_param **pp)
 {
-	struct vmod_directors_shard_param *p = *pp;
+	struct vmod_directors_shard_param *p;
 
-	if (p == NULL)
+	if (*pp == NULL)
 		return;
-	*pp = NULL;
-	CHECK_OBJ_NOTNULL(p, VMOD_SHARD_SHARD_PARAM_MAGIC);
+	TAKE_OBJ_NOTNULL(p, pp, VMOD_SHARD_SHARD_PARAM_MAGIC);
 	FREE_OBJ(p);
 }
 


More information about the varnish-commit mailing list