[master] 469d65e VSM_Delete() -> VSM_Destroy() to follow our current OO schema.

Poul-Henning Kamp phk at FreeBSD.org
Wed Jun 28 21:42:05 CEST 2017


commit 469d65e03406817b3ef96b04f826fd2d093ac30f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jun 28 19:40:41 2017 +0000

    VSM_Delete() -> VSM_Destroy() to follow our current OO schema.

diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index b983c52..52a6267 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -402,18 +402,18 @@ n_arg_sock(const char *n_arg)
 	AN(vsm);
 	if (VSM_n_Arg(vsm, n_arg) < 0) {
 		fprintf(stderr, "%s\n", VSM_Error(vsm));
-		VSM_Delete(vsm);
+		VSM_Destroy(&vsm);
 		return (-1);
 	}
 	if (VSM_Open(vsm)) {
 		fprintf(stderr, "%s\n", VSM_Error(vsm));
-		VSM_Delete(vsm);
+		VSM_Destroy(&vsm);
 		return (-1);
 	}
 
 	if (!VSM_Get(vsm, &vt, "Arg", "-T")) {
 		fprintf(stderr, "No -T arg in shared memory\n");
-		VSM_Delete(vsm);
+		VSM_Destroy(&vsm);
 		return (-1);
 	}
 	AZ(VSM_Map(vsm, &vt));
@@ -426,7 +426,7 @@ n_arg_sock(const char *n_arg)
 		S_arg = strdup(vt.b);
 	}
 
-	VSM_Delete(vsm);
+	VSM_Destroy(&vsm);
 
 	sock = -1;
 	while (*T_arg) {
diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c
index 6b79933..6804772 100644
--- a/bin/varnishtest/vtc_logexp.c
+++ b/bin/varnishtest/vtc_logexp.c
@@ -192,7 +192,7 @@ logexp_delete(struct logexp *le)
 	logexp_delete_tests(le);
 	free(le->name);
 	free(le->query);
-	VSM_Delete(le->vsm);
+	VSM_Destroy(&le->vsm);
 	if (le->n_arg)
 		VSB_destroy(&le->n_arg);
 	FREE_OBJ(le);
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 1488ce6..b31a16f 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -276,7 +276,7 @@ varnishlog_thread(void *priv)
 	if (c)
 		VSL_DeleteCursor(c);
 	VSL_Delete(vsl);
-	VSM_Delete(vsm);
+	VSM_Destroy(&vsm);
 
 	return (NULL);
 }
@@ -335,7 +335,7 @@ varnish_delete(struct varnish *v)
 	free(v->name);
 	free(v->workdir);
 	if (v->vd != NULL)
-		VSM_Delete(v->vd);
+		VSM_Destroy(&v->vd);
 
 	/*
 	 * We do not delete the workdir, it may contain stuff people
diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h
index a463e9a..37d25ef 100644
--- a/include/vapi/vsm.h
+++ b/include/vapi/vsm.h
@@ -70,7 +70,7 @@ struct vsm *VSM_New(void);
 	 *	NULL: malloc failed.
 	 */
 
-void VSM_Delete(struct vsm *vd);
+void VSM_Destroy(struct vsm **vd);
 	/*
 	 * Close and deallocate all storage and mappings.
 	 * (including any VSC and VSL "sub-classes")
diff --git a/lib/libvarnishapi/libvarnishapi.map b/lib/libvarnishapi/libvarnishapi.map
index 3a3fbe0..4ac8f19 100644
--- a/lib/libvarnishapi/libvarnishapi.map
+++ b/lib/libvarnishapi/libvarnishapi.map
@@ -182,6 +182,7 @@ LIBVARNISHAPI_1.7 {
 	VSM_invalid;
 	VSM_valid;
 	VSM_similar;
+	VSM_Destroy;
 	VSM_Map;
 	VSM_Unmap;
 	VSC_Destroy_Point;
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 8af47fd..e07f01b 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -216,8 +216,13 @@ VSM_Name(const struct vsm *vd)
 /*--------------------------------------------------------------------*/
 
 void
-VSM_Delete(struct vsm *vd)
+VSM_Destroy(struct vsm **vdp)
 {
+	struct vsm *vd;
+
+	AN(vdp);
+	vd = *vdp;
+	*vdp = NULL;
 
 	CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
 
diff --git a/lib/libvarnishapi/vut.c b/lib/libvarnishapi/vut.c
index f9faa10..1d110f7 100644
--- a/lib/libvarnishapi/vut.c
+++ b/lib/libvarnishapi/vut.c
@@ -336,7 +336,7 @@ VUT_Fini(void)
 	if (VUT.vsl)
 		VSL_Delete(VUT.vsl);
 	if (VUT.vsm)
-		VSM_Delete(VUT.vsm);
+		VSM_Destroy(&VUT.vsm);
 
 	memset(&VUT, 0, sizeof VUT);
 }



More information about the varnish-commit mailing list