[master] d9a393617 Remove deprecated VSB_new() and VSB_delete()

Poul-Henning Kamp phk at FreeBSD.org
Tue Aug 24 05:40:08 UTC 2021


commit d9a3936171c9ed04a4d257b7d99acb731ac9b84d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Aug 24 05:38:58 2021 +0000

    Remove deprecated VSB_new() and VSB_delete()

diff --git a/include/vrt.h b/include/vrt.h
index fd678e572..d65c19984 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -54,6 +54,7 @@
  * binary/load-time compatible, increment MAJOR version
  *
  * NEXT (2021-09-15)
+ *	VSB_new() and VSB_delete() removed
  *	VCL_STRINGLIST, vrt_magic_string_end removed
  *	VRT_String(), VRT_StringList(), VRT_CollectString() removed
  *	VRT_CollectStrands() renamed to VRT_STRANDS_string()
diff --git a/include/vsb.h b/include/vsb.h
index 7a32360e3..537254f4f 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -59,7 +59,6 @@ extern "C" {
 /*
  * API functions
  */
-struct vsb	*VSB_new(struct vsb *, char *, int, int) v_deprecated_;
 struct vsb	*VSB_init(struct vsb *, void *, ssize_t);
 struct vsb	*VSB_new_auto(void);
 void		 VSB_clear(struct vsb *);
@@ -76,7 +75,6 @@ int		 VSB_error(const struct vsb *);
 int		 VSB_finish(struct vsb *);
 char		*VSB_data(const struct vsb *);
 ssize_t		 VSB_len(const struct vsb *);
-void		 VSB_delete(struct vsb *) v_deprecated_;
 void		 VSB_fini(struct vsb *);
 void		 VSB_destroy(struct vsb **);
 
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index e868cade0..f7e9e46c3 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -208,35 +208,6 @@ VSB_newbuf(struct vsb *s, char *buf, int length, int flags)
 	return (s);
 }
 
-/*
- * Initialize an vsb.
- * If buf is non-NULL, it points to a static or already-allocated string
- * big enough to hold at least length characters.
- */
-struct vsb *
-VSB_new(struct vsb *s, char *buf, int length, int flags)
-{
-
-	KASSERT(length >= 0,
-	    ("attempt to create an vsb of negative length (%d)", length));
-	KASSERT((flags & ~VSB_USRFLAGMSK) == 0,
-	    ("%s called with invalid flags", __func__));
-
-	flags &= VSB_USRFLAGMSK;
-	if (s != NULL)
-		return (VSB_newbuf(s, buf, length, flags));
-
-	s = SBMALLOC(sizeof(*s));
-	if (s == NULL)
-		return (NULL);
-	if (VSB_newbuf(s, buf, length, flags) == NULL) {
-		SBFREE(s);
-		return (NULL);
-	}
-	VSB_SETFLAG(s, VSB_DYNSTRUCT);
-	return (s);
-}
-
 struct vsb *
 VSB_init(struct vsb *s, void *buf, ssize_t length)
 {
@@ -510,25 +481,6 @@ VSB_len(const struct vsb *s)
 	return (s->s_len);
 }
 
-/*
- * Clear an vsb, free its buffer if necessary.
- */
-void
-VSB_delete(struct vsb *s)
-{
-	int isdyn;
-
-	assert_VSB_integrity(s);
-	/* don't care if it's finished or not */
-
-	if (VSB_ISDYNAMIC(s))
-		SBFREE(s->s_buf);
-	isdyn = VSB_ISDYNSTRUCT(s);
-	memset(s, 0, sizeof(*s));
-	if (isdyn)
-		SBFREE(s);
-}
-
 void
 VSB_fini(struct vsb *s)
 {


More information about the varnish-commit mailing list