r2166 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Oct 24 12:24:09 CEST 2007


Author: phk
Date: 2007-10-24 12:24:08 +0200 (Wed, 24 Oct 2007)
New Revision: 2166

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_ws.c
Log:
Add a WS_Dup() function


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-10-23 12:42:10 UTC (rev 2165)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-10-24 10:24:08 UTC (rev 2166)
@@ -585,6 +585,7 @@
 void WS_Assert(const struct ws *ws);
 void WS_Reset(struct ws *ws);
 char *WS_Alloc(struct ws *ws, unsigned bytes);
+char *WS_Dup(struct ws *ws, const char *);
 
 /* rfc2616.c */
 int RFC2616_cache_policy(const struct sess *sp, const struct http *hp);

Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ws.c	2007-10-23 12:42:10 UTC (rev 2165)
+++ trunk/varnish-cache/bin/varnishd/cache_ws.c	2007-10-24 10:24:08 UTC (rev 2166)
@@ -96,6 +96,19 @@
 	return (r);
 }
 
+char *
+WS_Dup(struct ws *ws, const char *s)
+{
+	unsigned l;
+	char *p;
+
+	l = strlen(s) + 1;
+	p = WS_Alloc(ws, l);
+	if (p != NULL)
+		memcpy(p, s, l);
+	return (p);
+}
+
 unsigned
 WS_Reserve(struct ws *ws, unsigned bytes)
 {




More information about the varnish-commit mailing list