[4.1] c502f53 Add VSB_destroy(). It's like VSB_delete() but it NULL's the pointer.

Lasse Karstensen lkarsten at varnish-software.com
Fri Mar 4 15:53:47 CET 2016


commit c502f536077668e5a88a2383458ab829873c80e5
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 4b34314..83fb602 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
 void		 VSB_quote(struct vsb *s, const char *p, int len, int how);
 void		 VSB_indent(struct vsb *, int);
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index 4d80b8a..1f360d5 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