Commit 126d134b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a WS_Dup() function


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2166 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f6d0af2e
......@@ -585,6 +585,7 @@ void WS_ReleaseP(struct ws *ws, char *ptr);
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);
......
......@@ -96,6 +96,19 @@ WS_Alloc(struct ws *ws, unsigned bytes)
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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment