[master] e74a5a0 Constify VSB_len() and VSB_data()

Poul-Henning Kamp phk at varnish-cache.org
Sat Dec 15 11:16:14 CET 2012


commit e74a5a03f537b5715647345425a27ed279230314
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sat Dec 15 10:16:00 2012 +0000

    Constify VSB_len() and VSB_data()

diff --git a/include/vsb.h b/include/vsb.h
index e17fe5b..555b17f 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -76,8 +76,8 @@ int		 VSB_putc(struct vsb *, int);
 int		 VSB_trim(struct vsb *);
 int		 VSB_error(const struct vsb *);
 int		 VSB_finish(struct vsb *);
-char		*VSB_data(struct vsb *);
-ssize_t		 VSB_len(struct vsb *);
+char		*VSB_data(const struct vsb *);
+ssize_t		 VSB_len(const struct vsb *);
 int		 VSB_done(const struct vsb *);
 void		 VSB_delete(struct vsb *);
 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 16f6d4b..a751046 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -77,7 +77,7 @@ __FBSDID("$FreeBSD: head/sys/kern/subr_vsb.c 222004 2011-05-17 06:36:32Z phk $")
  */
 #if !defined(NDEBUG)
 static void
-_assert_VSB_integrity(const char *fun, struct vsb *s)
+_assert_VSB_integrity(const char *fun, const struct vsb *s)
 {
 
 	(void)fun;
@@ -93,7 +93,7 @@ _assert_VSB_integrity(const char *fun, struct vsb *s)
 }
 
 static void
-_assert_VSB_state(const char *fun, struct vsb *s, int state)
+_assert_VSB_state(const char *fun, const struct vsb *s, int state)
 {
 
 	(void)fun;
@@ -490,7 +490,7 @@ VSB_finish(struct vsb *s)
  * Return a pointer to the vsb data.
  */
 char *
-VSB_data(struct vsb *s)
+VSB_data(const struct vsb *s)
 {
 
 	assert_VSB_integrity(s);
@@ -503,7 +503,7 @@ VSB_data(struct vsb *s)
  * Return the length of the vsb data.
  */
 ssize_t
-VSB_len(struct vsb *s)
+VSB_len(const struct vsb *s)
 {
 
 	assert_VSB_integrity(s);



More information about the varnish-commit mailing list