[master] 97d2ffb34 Polish

Poul-Henning Kamp phk at FreeBSD.org
Tue Jan 12 14:55:08 UTC 2021


commit 97d2ffb3407b920a1a73d3ee6795b2f328348a75
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 12 14:47:29 2021 +0000

    Polish

diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 4dc9324b8..b93c1e9e4 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -574,8 +574,9 @@ VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
 			VRT_fail(ctx, "%s: Illegal IP", __func__);
 			return (NULL);
 		}
-	} else
+	} else {
 		assert(vep->ipv4== NULL && vep->ipv6== NULL);
+	}
 
 	vcl = ctx->vcl;
 	AN(vcl);
@@ -583,7 +584,8 @@ VRT_new_backend_clustered(VRT_CTX, struct vsmw_cluster *vc,
 
 	/* Create new backend */
 	ALLOC_OBJ(be, BACKEND_MAGIC);
-	XXXAN(be);
+	if (be == NULL)
+		return (NULL);
 	Lck_New(&be->mtx, lck_backend);
 
 #define DA(x)	do { if (vrt->x != NULL) REPLACE((be->x), (vrt->x)); } while (0)
diff --git a/bin/varnishd/cache/cache_tcp_pool.c b/bin/varnishd/cache/cache_tcp_pool.c
index 02db6c6f3..5614c9412 100644
--- a/bin/varnishd/cache/cache_tcp_pool.c
+++ b/bin/varnishd/cache/cache_tcp_pool.c
@@ -109,7 +109,8 @@ struct conn_pool {
 	int					holddown_errno;
 };
 
-static struct lock		conn_pools_mtx;
+static struct lock conn_pools_mtx;
+
 static VTAILQ_HEAD(, conn_pool)	conn_pools =
     VTAILQ_HEAD_INITIALIZER(conn_pools);
 
@@ -488,9 +489,9 @@ VCP_Get(struct conn_pool *cp, vtim_dur tmo, struct worker *wrk,
 	Lck_Lock(&cp->mtx);
 	pfd = VTAILQ_FIRST(&cp->connlist);
 	CHECK_OBJ_ORNULL(pfd, PFD_MAGIC);
-	if (force_fresh || pfd == NULL || pfd->state == PFD_STATE_STOLEN)
+	if (force_fresh || pfd == NULL || pfd->state == PFD_STATE_STOLEN) {
 		pfd = NULL;
-	else {
+	} else {
 		assert(pfd->conn_pool == cp);
 		assert(pfd->state == PFD_STATE_AVAIL);
 		VTAILQ_REMOVE(&cp->connlist, pfd, list);
diff --git a/bin/varnishd/cache/cache_tcp_pool.h b/bin/varnishd/cache/cache_tcp_pool.h
index c2fccb909..00e8518f5 100644
--- a/bin/varnishd/cache/cache_tcp_pool.h
+++ b/bin/varnishd/cache/cache_tcp_pool.h
@@ -34,6 +34,7 @@
 
 struct conn_pool;
 struct pfd;
+
 #define PFD_STATE_AVAIL		(1<<0)
 #define PFD_STATE_USED		(1<<1)
 #define PFD_STATE_STOLEN	(1<<2)
@@ -51,8 +52,6 @@ void PFD_RemoteName(const struct pfd *, char *, unsigned, char *, unsigned);
  * Prototypes
  */
 
-struct VSC_vbe;
-
 struct conn_pool *VTP_Ref(const struct vrt_endpoint *, const char *ident);
 	/*
 	 * Get a reference to a TCP pool. Either one or both of ipv4 or
@@ -101,7 +100,5 @@ int VCP_Wait(struct worker *, struct pfd *, vtim_real tmo);
 	 * function before attempting to receive on the connection.
 	 */
 
-void VCP_Panic(struct vsb *, struct conn_pool *);
-
 VCL_IP VCP_GetIp(struct pfd *);
 
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index 1ecab14d3..489691625 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -145,10 +145,6 @@ void VCA_Shutdown(void);
 void VBE_InitCfg(void);
 void VBE_Poll(void);
 
-/* cache_tcp_pool.c */
-void VCP_Init(void);
-
-/* cache_backend_poll.c */
 void VBP_Init(void);
 
 /* cache_ban.c */
@@ -421,6 +417,13 @@ void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why,
 void VSL_End(struct vsl_log *vsl);
 void VSL_Flush(struct vsl_log *, int overflow);
 
+/* cache_tcp_pool.c */
+struct conn_pool;
+void VCP_Init(void);
+void VCP_Panic(struct vsb *, struct conn_pool *);
+
+/* cache_backend_poll.c */
+
 /* cache_vary.c */
 int VRY_Create(struct busyobj *bo, struct vsb **psb);
 int VRY_Match(struct req *, const uint8_t *vary);


More information about the varnish-commit mailing list