[master] c671bb669 split out director deletion core

Nils Goroll nils.goroll at uplex.de
Mon Nov 18 15:05:08 UTC 2019


commit c671bb6691f27172ae9103226cb09a99c9812483
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Nov 13 16:56:33 2019 +0100

    split out director deletion core

diff --git a/bin/varnishd/cache/cache_vrt_vcl.c b/bin/varnishd/cache/cache_vrt_vcl.c
index 9356bceec..c1ee2c057 100644
--- a/bin/varnishd/cache/cache_vrt_vcl.c
+++ b/bin/varnishd/cache/cache_vrt_vcl.c
@@ -41,6 +41,8 @@
 #include "cache_director.h"
 #include "cache_vcl.h"
 
+static void deldirector(struct vcldir *);
+
 /*--------------------------------------------------------------------*/
 
 const char *
@@ -203,6 +205,16 @@ VRT_AddDirector(VRT_CTX, const struct vdi_methods *m, void *priv,
 	return (d);
 }
 
+static void
+deldirector(struct vcldir *vdir)
+{
+	if(vdir->methods->destroy != NULL)
+		vdir->methods->destroy(vdir->dir);
+	free(vdir->cli_name);
+	FREE_OBJ(vdir->dir);
+	FREE_OBJ(vdir);
+}
+
 void
 VRT_DelDirector(VCL_BACKEND *bp)
 {
@@ -223,12 +235,8 @@ VRT_DelDirector(VCL_BACKEND *bp)
 	if (VCL_WARM(vcl->temp))
 		VDI_Event(d, VCL_EVENT_COLD);
 	AZ(errno=pthread_rwlock_unlock(&vcl->temp_rwl));
-	if(vdir->methods->destroy != NULL)
-		vdir->methods->destroy(d);
 	assert (d == vdir->dir);
-	free(vdir->cli_name);
-	FREE_OBJ(vdir->dir);
-	FREE_OBJ(vdir);
+	deldirector(vdir);
 }
 
 void


More information about the varnish-commit mailing list