[master] f051f2699 flexelinting
Nils Goroll
nils.goroll at uplex.de
Tue Mar 10 12:43:06 UTC 2020
commit f051f269900f55471f8128c2129ad3dd71440e89
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue Mar 10 13:08:59 2020 +0100
flexelinting
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 0a685a4f3..9cecd54a3 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -280,7 +280,7 @@ vbe_dir_gethdrs(VRT_CTX, VCL_BACKEND d)
http_PrintfHeader(bo->bereq, "Host: %s", bp->hosthdr);
do {
- pfd = vbe_dir_getfd(wrk, bp, bo, extrachance == 0);
+ pfd = vbe_dir_getfd(wrk, bp, bo, extrachance == 0 ? 1 : 0);
if (pfd == NULL)
return (-1);
AN(bo->htc);
diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index 52b1871ba..39bc68196 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -724,13 +724,17 @@ static int v_matchproto_(binheap_cmp_t)
vbp_cmp(void *priv, const void *a, const void *b)
{
const struct vbp_target *aa, *bb;
+ int ar, br;
AZ(priv);
CAST_OBJ_NOTNULL(aa, a, VBP_TARGET_MAGIC);
CAST_OBJ_NOTNULL(bb, b, VBP_TARGET_MAGIC);
- if ((aa->running == 0) != (bb->running == 0))
- return (aa->running == 0);
+ ar = aa->running == 0;
+ br = bb->running == 0;
+
+ if (ar != br)
+ return (ar);
return (aa->due < bb->due);
}
diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c
index cc18eccb8..480d5adfc 100644
--- a/bin/varnishd/cache/cache_ban_lurker.c
+++ b/bin/varnishd/cache/cache_ban_lurker.c
@@ -374,7 +374,7 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl)
for (; b != NULL; b = VTAILQ_NEXT(b, list)) {
if (bd != NULL)
ban_lurker_test_ban(wrk, vsl, b, &obans, bd,
- count > cutoff);
+ count > cutoff ? 1 : 0);
if (b->flags & BANS_FLAG_COMPLETED)
continue;
if (b->flags & BANS_FLAG_REQ &&
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index dd51a468e..5319d6a76 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -730,6 +730,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
return (F_STP_FAIL);
}
}
+ AZ(stale_boc);
AZ(bo->stale_oc->flags & OC_F_FAILED);
AZ(vbf_beresp2obj(bo));
@@ -974,8 +975,11 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
VCL_TaskLeave(bo->privs);
http_Teardown(bo->bereq);
http_Teardown(bo->beresp);
+ // XXX after 6.4 release:
+ // bereq_body should have 0 or 1 references remaining,
+ // see VRB_Free() for the other end
if (bo->bereq_body != NULL)
- HSH_DerefObjCore(bo->wrk, &bo->bereq_body, 0);
+ (void) HSH_DerefObjCore(bo->wrk, &bo->bereq_body, 0);
if (bo->fetch_objcore->boc->state == BOS_FINISHED) {
AZ(bo->fetch_objcore->flags & OC_F_FAILED);
diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c
index c1f8bd344..9becb176b 100644
--- a/bin/varnishd/cache/cache_range.c
+++ b/bin/varnishd/cache/cache_range.c
@@ -210,13 +210,18 @@ vrg_ifrange(struct req *req)
}
/* assume date, strong check [RFC7232 2.2.2 p7] */
- if (!(ims = VTIM_parse(p))) // rfc7233,l,502,512
+ ims = VTIM_parse(p);
+ if (!ims) // rfc7233,l,502,512
return (0);
/* the response needs a Date */
// rfc7232 fc7232,l,439,440
- if (!http_GetHdr(req->resp, H_Date, &p) || !(d = VTIM_parse(p)))
+ if (!http_GetHdr(req->resp, H_Date, &p))
return (0);
+ d = VTIM_parse(p);
+ if (!d)
+ return (0);
+
/* grab the Last Modified value */
if (!http_GetHdr(req->resp, H_Last_Modified, &p))
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index b4ad19b90..1d34efe54 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -340,7 +340,7 @@ Pool_Work_Thread(struct pool *pp, struct worker *wrk)
struct pool_task *tp;
struct pool_task tpx, tps;
vtim_real tmo;
- int i, reserve;
+ unsigned i, reserve;
CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
wrk->pool = pp;
diff --git a/bin/varnishd/storage/storage_file.c b/bin/varnishd/storage/storage_file.c
index 52422e3bc..0fc157ef8 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
@@ -177,9 +177,8 @@ smf_init(struct stevedore *parent, int ac, char * const *av)
static void
insfree(struct smf_sc *sc, struct smf *sp)
{
- size_t b;
+ off_t b, ns;
struct smf *sp2;
- size_t ns;
AZ(sp->alloc);
assert(sp->flist == NULL);
@@ -231,10 +230,10 @@ remfree(const struct smf_sc *sc, struct smf *sp)
*/
static struct smf *
-alloc_smf(struct smf_sc *sc, size_t bytes)
+alloc_smf(struct smf_sc *sc, off_t bytes)
{
struct smf *sp, *sp2;
- size_t b;
+ off_t b;
AZ(bytes % sc->pagesize);
b = bytes / sc->pagesize;
@@ -398,8 +397,6 @@ smf_open_chunk(struct smf_sc *sc, off_t sz, off_t off, off_t *fail, off_t *sum)
*fail = sz;
h = sz / 2;
- if (h > SSIZE_MAX)
- h = SSIZE_MAX;
h -= (h % sc->pagesize);
smf_open_chunk(sc, h, off, fail, sum);
@@ -436,13 +433,16 @@ smf_open(struct stevedore *st)
/*--------------------------------------------------------------------*/
static struct storage * v_matchproto_(sml_alloc_f)
-smf_alloc(const struct stevedore *st, size_t size)
+smf_alloc(const struct stevedore *st, size_t sz)
{
struct smf *smf;
struct smf_sc *sc;
+ off_t size;
CAST_OBJ_NOTNULL(sc, st->priv, SMF_SC_MAGIC);
- assert(size > 0);
+ assert(sz > 0);
+ // XXX missing OFF_T_MAX
+ size = (off_t)sz;
size += (sc->pagesize - 1UL);
size &= ~(sc->pagesize - 1UL);
Lck_Lock(&sc->mtx);
More information about the varnish-commit
mailing list