r1372 - in trunk/varnish-cache: bin/varnishhist bin/varnishlog bin/varnishncsa include lib/libvarnishapi

des at projects.linpro.no des at projects.linpro.no
Tue May 1 19:55:31 CEST 2007


Author: des
Date: 2007-05-01 19:55:31 +0200 (Tue, 01 May 2007)
New Revision: 1372

Modified:
   trunk/varnish-cache/bin/varnishhist/varnishhist.c
   trunk/varnish-cache/bin/varnishlog/varnishlog.c
   trunk/varnish-cache/bin/varnishncsa/varnishncsa.c
   trunk/varnish-cache/include/varnishapi.h
   trunk/varnish-cache/lib/libvarnishapi/shmlog.c
Log:
Two minor logging fixes:
 
 - change the type of vsl_handler()'s tag argument from unsigned int to
   enum shmlogtag to allow gcc to check switch statements and gdb to show
   its value by name rather than by number.
 
 - fix the "missing newline after VCL_call" bug in varnishlog (#95)


Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c
===================================================================
--- trunk/varnish-cache/bin/varnishhist/varnishhist.c	2007-05-01 17:55:13 UTC (rev 1371)
+++ trunk/varnish-cache/bin/varnishhist/varnishhist.c	2007-05-01 17:55:31 UTC (rev 1372)
@@ -112,7 +112,7 @@
 }
 
 static int
-h_hist(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
+h_hist(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
 {
 	double b;
 	int i, j;

Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishlog/varnishlog.c	2007-05-01 17:55:13 UTC (rev 1371)
+++ trunk/varnish-cache/bin/varnishlog/varnishlog.c	2007-05-01 17:55:31 UTC (rev 1372)
@@ -94,7 +94,7 @@
 }
 
 static int
-h_order(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
+h_order(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
 {
 
 	(void)priv;
@@ -114,7 +114,7 @@
 	switch (tag) {
 	case SLT_VCL_call:
 		flg[fd] |= F_INVCL;
-		vsb_printf(ob[fd], "%5d %-12s %c %.*s",
+		vsb_printf(ob[fd], "%5d %-12s %c %.*s\n",
 		    fd, VSL_tags[tag],
 		    ((spec & VSL_S_CLIENT) ? 'c' : \
 		    (spec & VSL_S_BACKEND) ? 'b' : '-'),

Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c
===================================================================
--- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c	2007-05-01 17:55:13 UTC (rev 1371)
+++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c	2007-05-01 17:55:31 UTC (rev 1372)
@@ -164,7 +164,7 @@
 }
 
 static int
-h_ncsa(void *priv, unsigned tag, unsigned fd,
+h_ncsa(void *priv, enum shmlogtag tag, unsigned fd,
     unsigned len, unsigned spec, const char *ptr)
 {
 	const char *end, *next;

Modified: trunk/varnish-cache/include/varnishapi.h
===================================================================
--- trunk/varnish-cache/include/varnishapi.h	2007-05-01 17:55:13 UTC (rev 1371)
+++ trunk/varnish-cache/include/varnishapi.h	2007-05-01 17:55:31 UTC (rev 1372)
@@ -32,6 +32,8 @@
 #ifndef VARNISHAPI_H_INCLUDED
 #define VARNISHAPI_H_INCLUDED
 
+#include "shmlog.h"
+
 #define V_DEAD __attribute__ ((noreturn))
 
 /* base64.c */
@@ -39,7 +41,7 @@
 int base64_decode(char *d, unsigned dlen, const char *s);
 
 /* shmlog.c */
-typedef int vsl_handler(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr);
+typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr);
 #define VSL_S_CLIENT	(1 << 0)
 #define VSL_S_BACKEND	(1 << 1)
 #define VSL_ARGS	"bCcdI:i:r:X:x:"

Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/shmlog.c	2007-05-01 17:55:13 UTC (rev 1371)
+++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c	2007-05-01 17:55:31 UTC (rev 1372)
@@ -326,7 +326,7 @@
 /*--------------------------------------------------------------------*/
 
 int
-VSL_H_Print(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
+VSL_H_Print(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
 {
 	FILE *fo = priv;
 




More information about the varnish-commit mailing list