[master] 5367be3f6 HSH_DerefObjCore signedness fix
Nils Goroll
nils.goroll at uplex.de
Sat Oct 10 11:09:06 UTC 2020
commit 5367be3f62f45380ef7b5348eefb88a9c1507318
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sat Oct 10 13:05:33 2020 +0200
HSH_DerefObjCore signedness fix
noticed by Dridi here:
https://github.com/varnishcache/varnish-cache/pull/3434/commits/f9f40b991f301fb96d2e2d0d52b86c3d4b1f9f7f#r502302785
The reference count returned already is an unsigned value
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 9e80efcb1..c9eafa92b 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -975,7 +975,7 @@ HSH_DerefBoc(struct worker *wrk, struct objcore *oc)
* Returns zero if target was destroyed.
*/
-int
+unsigned
HSH_DerefObjCore(struct worker *wrk, struct objcore **ocp, int rushmax)
{
struct objcore *oc;
diff --git a/bin/varnishd/cache/cache_objhead.h b/bin/varnishd/cache/cache_objhead.h
index bc1782379..d9a015417 100644
--- a/bin/varnishd/cache/cache_objhead.h
+++ b/bin/varnishd/cache/cache_objhead.h
@@ -66,7 +66,7 @@ struct boc *HSH_RefBoc(const struct objcore *);
void HSH_DerefBoc(struct worker *wrk, struct objcore *);
void HSH_DeleteObjHead(const struct worker *, struct objhead *);
-int HSH_DerefObjCore(struct worker *, struct objcore **, int rushmax);
+unsigned HSH_DerefObjCore(struct worker *, struct objcore **, int rushmax);
#define HSH_RUSH_POLICY -1
enum lookup_e HSH_Lookup(struct req *, struct objcore **, struct objcore **);
diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index ecb78d769..fdec1bd4c 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -259,7 +259,7 @@ VRB_Ignore(struct req *req)
void
VRB_Free(struct req *req)
{
- int r;
+ unsigned r;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
@@ -268,7 +268,6 @@ VRB_Free(struct req *req)
r = HSH_DerefObjCore(req->wrk, &req->body_oc, 0);
-
// each busyobj may have gained a reference
assert (r <= req->restarts + 1);
}
More information about the varnish-commit
mailing list