[master] e50acd546 Simplify and appeace FlexeLint

Poul-Henning Kamp phk at FreeBSD.org
Mon Nov 4 12:46:06 UTC 2019


commit e50acd5460fbddbd75bf3570c1de041b629120bb
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Nov 4 12:34:53 2019 +0000

    Simplify and appeace FlexeLint

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index e13de2250..631a8a09d 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -104,8 +104,8 @@ cnt_transport(struct worker *wrk, struct req *req)
  * Deliver an object to client
  */
 
-static int
-resp_setup_deliver(struct req *req)
+int
+Resp_Setup_Deliver(struct req *req)
 {
 	struct http *h;
 	struct objcore *oc;
@@ -145,12 +145,11 @@ resp_setup_deliver(struct req *req)
 	    ObjCheckFlag(req->wrk, oc, OF_GZIPED) &&
 	    !RFC2616_Req_Gzip(req->http))
 		RFC2616_Weaken_Etag(h);
-
-	return (0);
+	return(0);
 }
 
-static int
-resp_setup_synth(struct req *req)
+void
+Resp_Setup_Synth(struct req *req)
 {
 	struct http *h;
 
@@ -175,23 +174,6 @@ resp_setup_synth(struct req *req)
 	 */
 	if (req->want100cont)
 		http_SetHeader(h, "Connection: close");
-
-	return (0);
-}
-
-int
-Resp_Setup(struct req *req, unsigned method)
-{
-	switch (method) {
-	case VCL_MET_DELIVER:
-		return (resp_setup_deliver(req));
-	case VCL_MET_SYNTH:
-		return (resp_setup_synth(req));
-	default:
-		WRONG("vcl method");
-	}
-
-	return (0);
 }
 
 static enum req_fsm_nxt
@@ -209,7 +191,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
 
 	ObjTouch(req->wrk, req->objcore, req->t_prev);
 
-	if (resp_setup_deliver(req)) {
+	if (Resp_Setup_Deliver(req)) {
 		(void)HSH_DerefObjCore(wrk, &req->objcore, HSH_RUSH_POLICY);
 		req->err_code = 500;
 		req->req_step = R_STP_SYNTH;
@@ -297,7 +279,7 @@ cnt_synth(struct worker *wrk, struct req *req)
 	if (req->err_code < 100)
 		req->err_code = 501;
 
-	(void) resp_setup_synth(req);
+	Resp_Setup_Synth(req);
 
 	synth_body = VSB_new_auto();
 	AN(synth_body);
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index f242b229c..b8ccb4704 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -361,7 +361,8 @@ void VRB_Free(struct req *);
 
 /* cache_req_fsm.c [CNT] */
 
-int Resp_Setup(struct req *, unsigned);
+int Resp_Setup_Deliver(struct req *);
+void Resp_Setup_Synth(struct req *);
 
 enum req_fsm_nxt {
 	REQ_FSM_MORE,
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 0fa600f2a..959b4be16 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -747,8 +747,10 @@ VRT_Rollback(VRT_CTX, VCL_HTTP hp)
 	if (hp == ctx->http_req) {
 		CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
 		Req_Rollback(ctx->req);
-		if ((ctx->method & (VCL_MET_DELIVER | VCL_MET_SYNTH)) != 0)
-			Resp_Setup(ctx->req, ctx->method);
+		if (ctx->method & VCL_MET_DELIVER)
+			XXXAZ(Resp_Setup_Deliver(ctx->req));
+		if (ctx->method & VCL_MET_SYNTH)
+			Resp_Setup_Synth(ctx->req);
 	} else if (hp == ctx->http_bereq) {
 		CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
 		Bereq_Rollback(ctx->bo);
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 01a379ddd..9f1386c5f 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -482,7 +482,7 @@ pool_breed(struct pool *qp)
 		if (cache_param->wthread_add_delay > 0.0)
 			VTIM_sleep(cache_param->wthread_add_delay);
 		else
-			sched_yield();
+			(void)sched_yield();
 	}
 
 	AZ(pthread_attr_destroy(&tp_attr));


More information about the varnish-commit mailing list