[master] 97014d3 Eliminate a surplus argument

Poul-Henning Kamp phk at FreeBSD.org
Tue Sep 23 11:47:59 CEST 2014


commit 97014d355a59bd34558cb3322075d40a49873276
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Sep 23 09:47:44 2014 +0000

    Eliminate a surplus argument

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 316e9bc..f12eb0c 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -740,7 +740,7 @@ void VBO_waitstate(struct busyobj *bo, enum busyobj_state_e want);
 
 
 /* cache_http1_fetch.c [V1F] */
-int V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req);
+int V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo);
 void V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc);
 
 /* cache_http1_fsm.c [HTTP1] */
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 8de0923..c28d1cb 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -265,7 +265,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 
 	assert(bo->state <= BOS_REQ_DONE);
 
-	i = V1F_fetch_hdr(wrk, bo, bo->req);
+	i = V1F_fetch_hdr(wrk, bo);
 	/*
 	 * If we recycle a backend connection, there is a finite chance
 	 * that the backend closed it before we get a request to it.
@@ -274,7 +274,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	if (i == 1) {
 		VSLb_ts_busyobj(bo, "Beresp", W_TIM_real(wrk));
 		VSC_C_main->backend_retry++;
-		i = V1F_fetch_hdr(wrk, bo, bo->req);
+		i = V1F_fetch_hdr(wrk, bo);
 	}
 	now = W_TIM_real(wrk);
 	VSLb_ts_busyobj(bo, "Beresp", now);
diff --git a/bin/varnishd/cache/cache_http1_fetch.c b/bin/varnishd/cache/cache_http1_fetch.c
index 3874fb5..a4c4ec5 100644
--- a/bin/varnishd/cache/cache_http1_fetch.c
+++ b/bin/varnishd/cache/cache_http1_fetch.c
@@ -73,7 +73,7 @@ vbf_iter_req_body(struct req *req, void *priv, void *ptr, size_t l)
  */
 
 int
-V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req)
+V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
 {
 	struct vbc *vc;
 	struct http *hp;
@@ -85,8 +85,8 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req)
 	int do_chunked = 0;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_ORNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_ORNULL(bo->req, REQ_MAGIC);
 	htc = bo->htc;
 
 	if (bo->director == NULL) {
@@ -114,7 +114,8 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req)
 	if (!http_GetHdr(bo->bereq, H_Host, NULL))
 		VDI_AddHostHeader(bo->bereq, vc);
 
-	if (req != NULL && req->req_body_status == REQ_BODY_WITHOUT_LEN) {
+	if (bo->req != NULL &&
+	    bo->req->req_body_status == REQ_BODY_WITHOUT_LEN) {
 		http_PrintfHeader(hp, "Transfer-Encoding: chunked");
 		do_chunked = 1;
 	}
@@ -126,18 +127,18 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req)
 	/* Deal with any message-body the request might (still) have */
 	i = 0;
 
-	if (req != NULL) {
+	if (bo->req != NULL) {
 		if (do_chunked)
 			WRW_Chunked(wrk);
-		i = VRB_Iterate(req, vbf_iter_req_body, wrk);
+		i = VRB_Iterate(bo->req, vbf_iter_req_body, wrk);
 
-		if (req->req_body_status == REQ_BODY_TAKEN) {
+		if (bo->req->req_body_status == REQ_BODY_TAKEN) {
 			retry = -1;
-		} else if (req->req_body_status == REQ_BODY_FAIL) {
+		} else if (bo->req->req_body_status == REQ_BODY_FAIL) {
 			VSLb(bo->vsl, SLT_FetchError,
 			    "req.body read error: %d (%s)",
 			    errno, strerror(errno));
-			req->doclose = SC_RX_BODY;
+			bo->req->doclose = SC_RX_BODY;
 			retry = -1;
 		}
 		if (do_chunked)



More information about the varnish-commit mailing list