[master] 88298f1 More sp -> req argument weakening
Poul-Henning Kamp
phk at varnish-cache.org
Mon Mar 12 20:35:14 CET 2012
commit 88298f16110c19173d0b27de4a3d8417867a192f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 12 19:35:00 2012 +0000
More sp -> req argument weakening
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 8f2381c..17f4f4d 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -749,8 +749,8 @@ void EXP_Set_ttl(struct exp *e, double v);
void EXP_Set_grace(struct exp *e, double v);
void EXP_Set_keep(struct exp *e, double v);
-double EXP_Ttl(const struct sess *, const struct object*);
-double EXP_Grace(const struct sess *, const struct object*);
+double EXP_Ttl(const struct req *, const struct object*);
+double EXP_Grace(const struct req *, const struct object*);
void EXP_Insert(struct object *o);
void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
void EXP_Init(void);
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 98b664f..9d7136c 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -109,39 +109,39 @@ EXP_ACCESS(keep, 0.,)
*/
static double
-EXP_Keep(const struct sess *sp, const struct object *o)
+EXP_Keep(const struct req *req, const struct object *o)
{
double r;
r = (double)cache_param->default_keep;
if (o->exp.keep > 0.)
r = o->exp.keep;
- if (sp != NULL && sp->req->exp.keep > 0. && sp->req->exp.keep < r)
- r = sp->req->exp.keep;
- return (EXP_Ttl(sp, o) + r);
+ if (req != NULL && req->exp.keep > 0. && req->exp.keep < r)
+ r = req->exp.keep;
+ return (EXP_Ttl(req, o) + r);
}
double
-EXP_Grace(const struct sess *sp, const struct object *o)
+EXP_Grace(const struct req *req, const struct object *o)
{
double r;
r = (double)cache_param->default_grace;
if (o->exp.grace >= 0.)
r = o->exp.grace;
- if (sp != NULL && sp->req->exp.grace > 0. && sp->req->exp.grace < r)
- r = sp->req->exp.grace;
- return (EXP_Ttl(sp, o) + r);
+ if (req != NULL && req->exp.grace > 0. && req->exp.grace < r)
+ r = req->exp.grace;
+ return (EXP_Ttl(req, o) + r);
}
double
-EXP_Ttl(const struct sess *sp, const struct object *o)
+EXP_Ttl(const struct req *req, const struct object *o)
{
double r;
r = o->exp.ttl;
- if (sp != NULL && sp->req->exp.ttl > 0. && sp->req->exp.ttl < r)
- r = sp->req->exp.ttl;
+ if (req != NULL && req->exp.ttl > 0. && req->exp.ttl < r)
+ r = req->exp.ttl;
return (o->exp.entered + r);
}
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 34e86a4..6a3af2f 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -357,14 +357,14 @@ HSH_Lookup(struct sess *sp)
continue;
/* If still valid, use it */
- if (EXP_Ttl(sp, o) >= sp->t_req)
+ if (EXP_Ttl(req, o) >= sp->t_req)
break;
/*
* Remember any matching objects inside their grace period
* and if there are several, use the least expired one.
*/
- if (EXP_Grace(sp, o) >= sp->t_req) {
+ if (EXP_Grace(req, o) >= sp->t_req) {
if (grace_oc == NULL ||
grace_ttl < o->exp.entered + o->exp.ttl) {
grace_oc = oc;
More information about the varnish-commit
mailing list