r2028 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Sep 25 09:40:01 CEST 2007


Author: phk
Date: 2007-09-25 09:40:01 +0200 (Tue, 25 Sep 2007)
New Revision: 2028

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
   trunk/varnish-cache/bin/varnishd/cache_synthetic.c
   trunk/varnish-cache/bin/varnishd/mgt_vcc.c
   trunk/varnish-cache/bin/varnishd/stevedore.c
Log:
Misc changes:

A couple of XXX comments
Some returnvalue asserts
Some pdiff() uses
Change WRK_Flush() to return unsigned



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-09-25 07:33:07 UTC (rev 2027)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-09-25 07:40:01 UTC (rev 2028)
@@ -490,7 +490,7 @@
 void WRK_Init(void);
 void WRK_QueueSession(struct sess *sp);
 void WRK_Reset(struct worker *w, int *fd);
-int WRK_Flush(struct worker *w);
+unsigned WRK_Flush(struct worker *w);
 unsigned WRK_Write(struct worker *w, const void *ptr, int len);
 unsigned WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf);
 #ifdef HAVE_SENDFILE

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2007-09-25 07:33:07 UTC (rev 2027)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2007-09-25 07:40:01 UTC (rev 2028)
@@ -146,7 +146,7 @@
 	assert(obj->hashlen >= sp->lhashptr);
 	b = obj->hash;
 	for (u = 0; u < sp->ihashptr; u += 2) {
-		v = sp->hashptr[u + 1] - sp->hashptr[u];
+		v = pdiff(sp->hashptr[u], sp->hashptr[u + 1]);
 		memcpy(b, sp->hashptr[u], v);
 		b += v;
 		*b++ = '#';

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2007-09-25 07:33:07 UTC (rev 2027)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2007-09-25 07:40:01 UTC (rev 2028)
@@ -91,7 +91,7 @@
 	w->wfd = fd;
 }
 
-int
+unsigned
 WRK_Flush(struct worker *w)
 {
 	int i;

Modified: trunk/varnish-cache/bin/varnishd/cache_synthetic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_synthetic.c	2007-09-25 07:33:07 UTC (rev 2027)
+++ trunk/varnish-cache/bin/varnishd/cache_synthetic.c	2007-09-25 07:40:01 UTC (rev 2028)
@@ -91,7 +91,7 @@
 	TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
 
 	/* generate body */
-	vsb_new(&vsb, (char *)st->ptr, st->space, VSB_FIXEDLEN);
+	AN(vsb_new(&vsb, (char *)st->ptr, st->space, VSB_FIXEDLEN));
 	vsb_printf(&vsb,
 	    "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
 	    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"

Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2007-09-25 07:33:07 UTC (rev 2027)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2007-09-25 07:40:01 UTC (rev 2028)
@@ -277,6 +277,11 @@
 		return (NULL);
 	} 
 
+	/*
+	 * XXX: we should look up and check the handle in the loaded
+	 * object
+	 */
+
 	AZ(dlclose(p));
 	return (of);
 }
@@ -618,6 +623,9 @@
 	}
 }
 
+/*
+ * XXX: This should take an option argument to show all (include) files
+ */
 void
 mcf_config_show(struct cli *cli, char **av, void *priv)
 {
@@ -635,12 +643,12 @@
 			cli_out(cli, "failed to locate source for %s: %s\n",
 			    vp->name, dlerror());
 			cli_result(cli, CLIS_CANT);
-			dlclose(dlh);
+			AZ(dlclose(dlh));
 		} else {
 			src = sym;
 			cli_out(cli, src[0]);
 			/* cli_out(cli, src[1]); */
-			dlclose(dlh);
+			AZ(dlclose(dlh));
 		}
 	}
 }

Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c	2007-09-25 07:33:07 UTC (rev 2027)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c	2007-09-25 07:40:01 UTC (rev 2028)
@@ -94,9 +94,12 @@
 static int
 cmp_storage(const struct stevedore *s, const char *p, const char *q)
 {
-	if (strlen(s->name) != q - p)
+	unsigned u;
+
+	u = pdiff(p, q);
+	if (strlen(s->name) != u)
 		return (1);
-	if (strncmp(s->name, p, q - p))
+	if (strncmp(s->name, p, u))
 		return (1);
 	return (0);
 }




More information about the varnish-commit mailing list