[master] a889566 Get rid of the last trace if the libvarnish.h kitchen-sink: bprint macros go in vdef.h, VCS_* in vcs.h
Poul-Henning Kamp
phk at varnish-cache.org
Sun Oct 9 22:07:57 CEST 2011
commit a88956622c34e38826d5f816dad0e0e936813c0c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Oct 9 20:07:25 2011 +0000
Get rid of the last trace if the libvarnish.h kitchen-sink:
bprint macros go in vdef.h, VCS_* in vcs.h
diff --git a/bin/varnishd/common.h b/bin/varnishd/common.h
index 0e6d95d..7fd15b7 100644
--- a/bin/varnishd/common.h
+++ b/bin/varnishd/common.h
@@ -28,11 +28,12 @@
*
*/
-#include "libvarnish.h"
+#include "miniobj.h"
#include "vas.h"
-#include "vsb.h"
+#include "vcs.h"
+#include "vdef.h"
#include "vqueue.h"
-#include "miniobj.h"
+#include "vsb.h"
struct cli;
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 92d17b3..e2fc652 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -49,7 +49,7 @@
#include <unistd.h>
#include "vas.h"
-#include "libvarnish.h"
+#include "vcs.h"
#define HIST_N 2000 /* how far back we remember */
#define HIST_LOW -6 /* low end of log range */
diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c
index 3142d1b..86c8504 100644
--- a/bin/varnishlog/varnishlog.c
+++ b/bin/varnishlog/varnishlog.c
@@ -44,11 +44,10 @@
#include "compat/daemon.h"
-#include "vsb.h"
-#include "vpf.h"
-
#include "vas.h"
-#include "libvarnish.h"
+#include "vcs.h"
+#include "vpf.h"
+#include "vsb.h"
static int b_flag, c_flag;
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 4805d81..05b8dfe 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -74,12 +74,12 @@
#include "compat/daemon.h"
#include "vas.h"
-#include "vsb.h"
+#include "vcs.h"
#include "vpf.h"
#include "vqueue.h"
-
-#include "libvarnish.h"
#include "vre.h"
+#include "vsb.h"
+
#include "base64.h"
static volatile sig_atomic_t reopen;
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index ef4118a..ffc403f 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -46,10 +46,9 @@
#include <string.h>
#include <unistd.h>
-#include "vqueue.h"
-
#include "vas.h"
-#include "libvarnish.h"
+#include "vcs.h"
+#include "vqueue.h"
#include "vss.h"
#define freez(x) do { if (x) free(x); x = NULL; } while (0);
diff --git a/bin/varnishsizes/varnishsizes.c b/bin/varnishsizes/varnishsizes.c
index 70fcad1..d3e3218 100644
--- a/bin/varnishsizes/varnishsizes.c
+++ b/bin/varnishsizes/varnishsizes.c
@@ -49,7 +49,7 @@
#include <unistd.h>
#include "vas.h"
-#include "libvarnish.h"
+#include "vcs.h"
#define HIST_N 2000 /* how far back we remember */
#define HIST_LOW 1 /* low end of log range */
diff --git a/bin/varnishstat/varnishstat.h b/bin/varnishstat/varnishstat.h
index 322ebc4..314c7c5 100644
--- a/bin/varnishstat/varnishstat.h
+++ b/bin/varnishstat/varnishstat.h
@@ -28,6 +28,6 @@
*/
#include "vas.h"
-#include "libvarnish.h"
+#include "vcs.h"
void do_curses(struct VSM_data *vd, const struct VSC_C_main *VSC_C_main, int delay);
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 83bbb22..4404de9 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -41,7 +41,6 @@
#include "vav.h"
#include "vtim.h"
-#include "libvarnish.h"
#ifndef HAVE_SRANDOMDEV
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index 3621dc5..1340314 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -36,6 +36,7 @@
#include "miniobj.h"
#include "vas.h"
+#include "vdef.h"
#include "vqueue.h"
#include "vsb.h"
diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index 55e25fa..2547d80 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -39,7 +39,6 @@
#include "vss.h"
#include "vtcp.h"
-#include "libvarnish.h"
struct client {
unsigned magic;
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 50816bc..889891b 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -37,14 +37,10 @@
#include <sys/socket.h>
#include "vct.h"
-
-#include "libvarnish.h"
-
+#include "vgz.h"
#include "vtc.h"
#include "vtcp.h"
-#include "vgz.h"
-
#define MAX_HDR 50
struct http {
diff --git a/bin/varnishtest/vtc_log.c b/bin/varnishtest/vtc_log.c
index c06f319..753de58 100644
--- a/bin/varnishtest/vtc_log.c
+++ b/bin/varnishtest/vtc_log.c
@@ -34,8 +34,6 @@
#include <stdarg.h>
#include "vtc.h"
-
-#include "libvarnish.h"
#include "vtim.h"
static pthread_mutex_t vtclog_mtx;
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 040afdc..3b9d81b 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -38,10 +38,8 @@
#include <sys/types.h>
#include <sys/wait.h>
-#include "vtc.h"
-
-#include "libvarnish.h"
#include "vev.h"
+#include "vtc.h"
#include "vtim.h"
#ifndef HAVE_SRANDOMDEV
diff --git a/bin/varnishtest/vtc_sema.c b/bin/varnishtest/vtc_sema.c
index 8a9228a..c363b4a 100644
--- a/bin/varnishtest/vtc_sema.c
+++ b/bin/varnishtest/vtc_sema.c
@@ -35,8 +35,6 @@
#include "vtc.h"
-#include "libvarnish.h"
-
struct sema {
unsigned magic;
#define SEMA_MAGIC 0x29b64317
diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index afe62af..5a768a1 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -36,12 +36,10 @@
#include <sys/types.h>
#include <sys/socket.h>
+#include "vss.h"
#include "vtc.h"
#include "vtcp.h"
-#include "libvarnish.h"
-#include "vss.h"
-
struct server {
unsigned magic;
#define SERVER_MAGIC 0x55286619
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 8b310f6..ba19464 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -45,13 +45,10 @@
#include <sys/wait.h>
#include <sys/socket.h>
-#include "vtc.h"
-#include "vtcp.h"
-
-#include "libvarnish.h"
-
#include "vcli.h"
#include "vss.h"
+#include "vtc.h"
+#include "vtcp.h"
struct varnish {
unsigned magic;
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 1022e32..34278ea 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -46,13 +46,11 @@
#include <unistd.h>
#include <limits.h>
+#include "vas.h"
+#include "vcs.h"
#include "vqueue.h"
-
#include "vsb.h"
-#include "vas.h"
-#include "libvarnish.h"
-
#if 0
#define AC(x) assert((x) != ERR)
#else
diff --git a/include/Makefile.am b/include/Makefile.am
index 70be7f7..320f18c 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -32,7 +32,6 @@ nobase_noinst_HEADERS = \
compat/execinfo.h \
compat/srandomdev.h \
flopen.h \
- libvarnish.h \
libvcl.h \
miniobj.h \
persistent.h \
@@ -41,7 +40,9 @@ nobase_noinst_HEADERS = \
vbm.h \
vcl.h \
vcs_version.h \
+ vcs.h \
vct.h \
+ vdef.h \
vend.h \
vev.h \
vfil.h \
diff --git a/include/libvarnish.h b/include/libvarnish.h
deleted file mode 100644
index 4cbb18d..0000000
--- a/include/libvarnish.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2011 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/* from libvarnish/version.c */
-void VCS_Message(const char *);
-
-/* Safe printf into a fixed-size buffer */
-#define bprintf(buf, fmt, ...) \
- do { \
- assert(snprintf(buf, sizeof buf, fmt, __VA_ARGS__) \
- < sizeof buf); \
- } while (0)
-
-/* Safe printf into a fixed-size buffer */
-#define vbprintf(buf, fmt, ap) \
- do { \
- assert(vsnprintf(buf, sizeof buf, fmt, ap) \
- < sizeof buf); \
- } while (0)
-
diff --git a/include/vcs.h b/include/vcs.h
new file mode 100644
index 0000000..f764100
--- /dev/null
+++ b/include/vcs.h
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2011 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* from libvarnish/version.c */
+void VCS_Message(const char *);
diff --git a/include/vdef.h b/include/vdef.h
new file mode 100644
index 0000000..c9b24c5
--- /dev/null
+++ b/include/vdef.h
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2011 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* Safe printf into a fixed-size buffer */
+#define bprintf(buf, fmt, ...) \
+ do { \
+ assert(snprintf(buf, sizeof buf, fmt, __VA_ARGS__) \
+ < sizeof buf); \
+ } while (0)
+
+/* Safe printf into a fixed-size buffer */
+#define vbprintf(buf, fmt, ap) \
+ do { \
+ assert(vsnprintf(buf, sizeof buf, fmt, ap) \
+ < sizeof buf); \
+ } while (0)
+
diff --git a/lib/libvarnish/version.c b/lib/libvarnish/version.c
index 014eda4..2220a69 100644
--- a/lib/libvarnish/version.c
+++ b/lib/libvarnish/version.c
@@ -33,7 +33,7 @@
#include <stdio.h>
-#include "libvarnish.h"
+#include "vcs.h"
#include "vcs_version.h"
void
diff --git a/lib/libvarnish/vfil.c b/lib/libvarnish/vfil.c
index 884b106..a4bab9e 100644
--- a/lib/libvarnish/vfil.c
+++ b/lib/libvarnish/vfil.c
@@ -40,8 +40,8 @@
#include <sys/stat.h>
#include "vas.h"
+#include "vdef.h"
#include "vfil.h"
-#include "libvarnish.h"
int
VFIL_tmpfile(char *template)
diff --git a/lib/libvarnish/vin.c b/lib/libvarnish/vin.c
index ccd58a9..65fdb5e 100644
--- a/lib/libvarnish/vin.c
+++ b/lib/libvarnish/vin.c
@@ -37,9 +37,9 @@
#include <unistd.h>
#include "vas.h"
-#include "vsm.h"
+#include "vdef.h"
#include "vin.h"
-#include "libvarnish.h"
+#include "vsm.h"
int
VIN_N_Arg(const char *n_arg, char **name, char **dir, char **vsl)
diff --git a/lib/libvarnish/vlu.c b/lib/libvarnish/vlu.c
index 01d21de..1334a28 100644
--- a/lib/libvarnish/vlu.c
+++ b/lib/libvarnish/vlu.c
@@ -33,7 +33,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include "libvarnish.h"
#include "vas.h"
#include "vlu.h"
#include "miniobj.h"
diff --git a/lib/libvarnish/vmb.c b/lib/libvarnish/vmb.c
index 2c004ce..aa069a7 100644
--- a/lib/libvarnish/vmb.c
+++ b/lib/libvarnish/vmb.c
@@ -28,7 +28,6 @@
#include <pthread.h>
#include <unistd.h>
-#include "libvarnish.h"
#include "vmb.h"
#ifdef VMB_NEEDS_PTHREAD_WORKAROUND_THIS_IS_BAD_FOR_PERFORMANCE
diff --git a/lib/libvarnish/vpf.c b/lib/libvarnish/vpf.c
index f6543c6..7875c15 100644
--- a/lib/libvarnish/vpf.c
+++ b/lib/libvarnish/vpf.c
@@ -40,7 +40,6 @@
#include <string.h>
#include <unistd.h>
-#include "libvarnish.h" /* XXX: for assert() */
#include "flopen.h"
#include "vas.h"
#include "vpf.h"
diff --git a/lib/libvarnish/vre.c b/lib/libvarnish/vre.c
index e330e99..2810bc2 100644
--- a/lib/libvarnish/vre.c
+++ b/lib/libvarnish/vre.c
@@ -29,7 +29,6 @@
#include <pcre.h>
#include <string.h>
-#include "libvarnish.h"
#include "miniobj.h"
#include "vas.h"
#include "vre.h"
diff --git a/lib/libvarnish/vtim.c b/lib/libvarnish/vtim.c
index edfb8a5..772b559 100644
--- a/lib/libvarnish/vtim.c
+++ b/lib/libvarnish/vtim.c
@@ -56,7 +56,6 @@
#include "vas.h"
#include "vtim.h"
-//#include "libvarnish.h"
/*
* Note on Solaris: for some reason, clock_gettime(CLOCK_MONOTONIC, &ts) is not
diff --git a/lib/libvcl/vcc_compile.h b/lib/libvcl/vcc_compile.h
index ebbba86..a245a36 100644
--- a/lib/libvcl/vcc_compile.h
+++ b/lib/libvcl/vcc_compile.h
@@ -30,11 +30,10 @@
#include <stdint.h>
-#include "libvarnish.h"
-#include "vas.h"
-
#include "miniobj.h"
+#include "vas.h"
#include "vcl.h"
+#include "vdef.h"
#include "vqueue.h"
#include "vsb.h"
More information about the varnish-commit
mailing list