[master] ddd00e1 Make vsb's conform to miniobj.h convention

Poul-Henning Kamp phk at FreeBSD.org
Fri Jan 10 15:49:03 CET 2014


commit ddd00e1075c3258602858dffc1ac04d7d4bb4e3f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Jan 10 14:48:42 2014 +0000

    Make vsb's conform to miniobj.h convention
    
    Spotted by:	daghf

diff --git a/include/vsb.h b/include/vsb.h
index 555b17f..3734361 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -37,7 +37,8 @@
  * Structure definition
  */
 struct vsb {
-	unsigned	s_magic;
+	unsigned	magic;
+#define VSB_MAGIC	0x4a82dd8a
 	char		*s_buf;		/* storage buffer */
 	int		 s_error;	/* current error code */
 	ssize_t		 s_size;	/* size of storage buffer */
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index a751046..91a7fa2 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -45,7 +45,6 @@ __FBSDID("$FreeBSD: head/sys/kern/subr_vsb.c 222004 2011-05-17 06:36:32Z phk $")
 
 #define	roundup2(x, y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
 
-#define VSB_MAGIC		0x4a82dd8a
 /*
  * Predicates
  */
@@ -84,8 +83,8 @@ _assert_VSB_integrity(const char *fun, const struct vsb *s)
 	(void)s;
 	KASSERT(s != NULL,
 	    ("%s called with a NULL vsb pointer", fun));
-	KASSERT(s->s_magic == VSB_MAGIC,
-	    ("%s called wih an unintialized vsb pointer", fun));
+	KASSERT(s->magic == VSB_MAGIC,
+	    ("%s called wih an bogus vsb pointer", fun));
 	KASSERT(s->s_buf != NULL,
 	    ("%s called with uninitialized or corrupt vsb", fun));
 	KASSERT(s->s_len < s->s_size,
@@ -167,7 +166,7 @@ VSB_newbuf(struct vsb *s, char *buf, int length, int flags)
 {
 
 	memset(s, 0, sizeof(*s));
-	s->s_magic = VSB_MAGIC;
+	s->magic = VSB_MAGIC;
 	s->s_flags = flags;
 	s->s_size = length;
 	s->s_buf = buf;



More information about the varnish-commit mailing list