Permalink
Browse files

Eliminate some grubbing around inside struct ws

  • Loading branch information...
1 parent 92e77b8 commit 4e0004eaa456654975aa0e0a32d51ad57bafd616 @bsdphk bsdphk committed Feb 15, 2017
Showing with 7 additions and 4 deletions.
  1. +1 −1 bin/varnishd/cache/cache_req_fsm.c
  2. +1 −1 bin/varnishd/cache/cache_ws.c
  3. +5 −2 lib/libvmod_debug/vmod_debug.c
@@ -915,7 +915,7 @@ CNT_Request(struct worker *wrk, struct req *req)
* empty on state-transitions.
*/
WS_Assert(wrk->aws);
- assert(wrk->aws->s == wrk->aws->f);
+ AZ(WS_Snapshot(wrk->aws));
switch (req->req_step) {
#define REQ_STEP(l,u,arg) \
@@ -215,7 +215,7 @@ WS_Snapshot(struct ws *ws)
WS_Assert(ws);
assert(ws->r == NULL);
DSL(DBG_WORKSPACE, 0, "WS_Snapshot(%p) = %p", ws, ws->f);
- return ((uintptr_t)ws->f);
+ return (ws->f == ws->s ? 0 : (uintptr_t)ws->f);
}
unsigned
@@ -420,14 +420,17 @@ VCL_INT
vmod_workspace_free(VRT_CTX, VCL_ENUM which)
{
struct ws *ws;
+ unsigned u;
+
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
ws = wsfind(ctx, which);
WS_Assert(ws);
- AZ(ws->r);
+ u = WS_Reserve(ws, 0);
+ WS_Release(ws, 0);
- return (pdiff(ws->f, ws->e));
+ return (u);
}
VCL_BOOL

0 comments on commit 4e0004e

Please sign in to comment.