[6.0] aa809b5dd polish: use TAKE_OBJ_NOTNULL
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Thu Aug 16 08:53:15 UTC 2018
commit aa809b5dd2fb36b76604eaf0d6e71052fcb7738f
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 7a667c368..a83fc44dc 100644
--- a/lib/libvmod_directors/shard_dir.c
+++ b/lib/libvmod_directors/shard_dir.c
@@ -241,11 +241,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 797098abd..98f9c0321 100644
--- a/lib/libvmod_directors/vmod_shard.c
+++ b/lib/libvmod_directors/vmod_shard.c
@@ -263,10 +263,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);
free(vshard->dir->vcl_name);
FREE_OBJ(vshard->dir);
@@ -794,12 +793,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