[master] f217f3e Be more consistent about using the VCL typedefs

Poul-Henning Kamp phk at varnish-cache.org
Tue Sep 10 12:57:27 CEST 2013


commit f217f3ebb72bd665bf0f2a113e336bc2ea1939aa
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Sep 10 10:57:04 2013 +0000

    Be more consistent about using the VCL typedefs

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index e4aecb1..974bbd7 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -297,24 +297,26 @@ VRT_r_now(const struct vrt_ctx *ctx)
 /*--------------------------------------------------------------------*/
 
 char *
-VRT_IP_string(const struct vrt_ctx *ctx, const struct sockaddr_storage *sa)
+VRT_IP_string(const struct vrt_ctx *ctx, const VCL_IP ip)
 {
 	char *p;
+	const struct sockaddr *sa;
 	const struct sockaddr_in *si4;
 	const struct sockaddr_in6 *si6;
 	const void *addr;
 	int len;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	switch (sa->ss_family) {
+	sa = ip;
+	switch (sa->sa_family) {
 	case AF_INET:
 		len = INET_ADDRSTRLEN;
-		si4 = (const void *)sa;
+		si4 = ip;
 		addr = &(si4->sin_addr);
 		break;
 	case AF_INET6:
 		len = INET6_ADDRSTRLEN;
-		si6 = (const void *)sa;
+		si6 = ip;
 		addr = &(si6->sin6_addr);
 		break;
 	default:
@@ -322,7 +324,7 @@ VRT_IP_string(const struct vrt_ctx *ctx, const struct sockaddr_storage *sa)
 	}
 	XXXAN(len);
 	AN(p = WS_Alloc(ctx->ws, len));
-	AN(inet_ntop(sa->ss_family, addr, p, len));
+	AN(inet_ntop(sa->sa_family, addr, p, len));
 	return (p);
 }
 
@@ -364,8 +366,8 @@ VRT_TIME_string(const struct vrt_ctx *ctx, double t)
 	return (p);
 }
 
-const char *
-VRT_BACKEND_string(const struct director *d)
+const char * __match_proto__()
+VRT_BACKEND_string(VCL_BACKEND d)
 {
 	if (d == NULL)
 		return (NULL);
diff --git a/include/vrt.h b/include/vrt.h
index d229655..7d03c47 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -252,10 +252,10 @@ int VRT_Stv(const char *nm);
 
 /* Convert things to string */
 
-char *VRT_IP_string(const struct vrt_ctx *, const struct sockaddr_storage *sa);
-char *VRT_INT_string(const struct vrt_ctx *, long);
-char *VRT_REAL_string(const struct vrt_ctx *, double);
-char *VRT_TIME_string(const struct vrt_ctx *, double);
-const char *VRT_BOOL_string(unsigned);
-const char *VRT_BACKEND_string(const struct director *d);
+char *VRT_IP_string(const struct vrt_ctx *, VCL_IP);
+char *VRT_INT_string(const struct vrt_ctx *, VCL_INT);
+char *VRT_REAL_string(const struct vrt_ctx *, VCL_REAL);
+char *VRT_TIME_string(const struct vrt_ctx *, VCL_TIME);
+const char *VRT_BOOL_string(VCL_BOOL);
+const char *VRT_BACKEND_string(VCL_BACKEND);
 const char *VRT_CollectString(const struct vrt_ctx *, const char *p, ...);



More information about the varnish-commit mailing list