r5097 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Thu Aug 12 10:38:52 CEST 2010


Author: phk
Date: 2010-08-12 10:38:51 +0200 (Thu, 12 Aug 2010)
New Revision: 5097

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_backend.c
Log:
Constification



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2010-08-12 08:13:15 UTC (rev 5096)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2010-08-12 08:38:51 UTC (rev 5097)
@@ -473,7 +473,7 @@
 extern pthread_t VCA_thread;
 
 /* cache_backend.c */
-void VBE_UseHealth(struct director *vdi);
+void VBE_UseHealth(const struct director *vdi);
 
 struct vbc *VDI_GetFd(const struct director *, struct sess *sp);
 int VDI_Healthy(double now, const struct director *, uintptr_t target);

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-08-12 08:13:15 UTC (rev 5096)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-08-12 08:38:51 UTC (rev 5097)
@@ -127,7 +127,7 @@
 
 static int
 vbe_TryConnect(const struct sess *sp, int pf, const struct sockaddr *sa,
-    socklen_t salen, struct vdi_simple *vs)
+    socklen_t salen, const struct vdi_simple *vs)
 {
 	int s, i, tmo;
 	double tmod;
@@ -166,7 +166,7 @@
 /*--------------------------------------------------------------------*/
 
 static int
-bes_conn_try(const struct sess *sp, struct vdi_simple *vs)
+bes_conn_try(const struct sess *sp, const struct vdi_simple *vs)
 {
 	int s;
 	struct backend *bp = vs->backend;
@@ -261,15 +261,17 @@
  */
 
 static unsigned int
-vbe_Healthy(double now, uintptr_t target, struct vdi_simple *vs, struct backend *backend)
+vbe_Healthy(double now, uintptr_t target, const struct vdi_simple *vs)
 {
 	struct trouble *tr;
 	struct trouble *tr2;
 	struct trouble *old;
 	unsigned i = 0, retval;
 	unsigned int threshold;
+	struct backend *backend;
 
 	CHECK_OBJ_NOTNULL(vs, VDI_SIMPLE_MAGIC);
+	backend = vs->backend;
 	CHECK_OBJ_NOTNULL(backend, BACKEND_MAGIC);
 
 	if (!backend->healthy)
@@ -369,7 +371,7 @@
 		VDI_CloseFd(sp);
 	}
 
-	if (!vbe_Healthy(sp->t_req, (uintptr_t)sp->objhead, vs, bp)) {
+	if (!vbe_Healthy(sp->t_req, (uintptr_t)sp->objhead, vs)) {
 		VSC_main->backend_unhealthy++;
 		return (NULL);
 	}
@@ -422,7 +424,7 @@
  */
 
 void
-VBE_UseHealth(struct director *vdi)
+VBE_UseHealth(const struct director *vdi)
 {
 	struct vdi_simple *vs;
 
@@ -466,7 +468,7 @@
 
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
-	return (vbe_Healthy(now, target, vs, vs->backend));
+	return (vbe_Healthy(now, target, vs));
 }
 
 /*lint -e{818} not const-able */




More information about the varnish-commit mailing list