Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
Change the code to work with trunk Varnish.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbgrydeland committed Apr 13, 2012
1 parent b7de64f commit 43ff4ae
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/vmod_example.c
@@ -1,7 +1,8 @@
#include <stdlib.h>
#include <stdio.h>

#include "vrt.h"
#include "bin/varnishd/cache.h"
#include "cache/cache.h"

#include "vcc_if.h"

Expand All @@ -17,16 +18,16 @@ vmod_hello(struct sess *sp, const char *name)
char *p;
unsigned u, v;

u = WS_Reserve(sp->wrk->ws, 0); /* Reserve some work space */
p = sp->wrk->ws->f; /* Front of workspace area */
u = WS_Reserve(sp->req->ws, 0); /* Reserve some work space */
p = sp->req->ws->f; /* Front of workspace area */
v = snprintf(p, u, "Hello, %s", name);
v++;
if (v > u) {
/* No space, reset and leave */
WS_Release(sp->wrk->ws, 0);
WS_Release(sp->req->ws, 0);
return (NULL);
}
/* Update work space with what we've used */
WS_Release(sp->wrk->ws, v);
WS_Release(sp->req->ws, v);
return (p);
}

0 comments on commit 43ff4ae

Please sign in to comment.