[master] 362289a Add VSB_destroy(). It's like VSB_delete() but it NULL's the pointer.

Poul-Henning Kamp phk at FreeBSD.org
Fri Feb 26 09:32:11 CET 2016


commit 362289ae023fb02442f0106bd97d69dbbf627b59
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Feb 26 08:19:54 2016 +0000

    Add VSB_destroy().  It's like VSB_delete() but it NULL's the pointer.

diff --git a/include/vsb.h b/include/vsb.h
index a3bdd3d..7761255 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -75,6 +75,7 @@ int		 VSB_finish(struct vsb *);
 char		*VSB_data(const struct vsb *);
 ssize_t		 VSB_len(const struct vsb *);
 void		 VSB_delete(struct vsb *);
+void		 VSB_destroy(struct vsb **);
 #define VSB_QUOTE_NONL	1
 #define VSB_QUOTE_JSON	2
 void		 VSB_quote(struct vsb *s, const char *p, int len, int how);
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index d737ef1..f5915bd 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -489,6 +489,13 @@ VSB_delete(struct vsb *s)
 		SBFREE(s);
 }
 
+void
+VSB_destroy(struct vsb **s)
+{
+	VSB_delete(*s);
+	*s = NULL;
+}
+
 /*
  * Quote a string
  */



More information about the varnish-commit mailing list