[master] 4dad6c4 Make WS_Alloc() return a void* like any sane memory allocator should

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 13 10:42:30 CEST 2014


commit 4dad6c4163abae013c980da01bb04a881e8346b1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 13 08:42:08 2014 +0000

    Make WS_Alloc() return a void* like any sane memory allocator should

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 254c22e..839516d 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1146,7 +1146,7 @@ void WS_Release(struct ws *ws, unsigned bytes);
 void WS_ReleaseP(struct ws *ws, char *ptr);
 void WS_Assert(const struct ws *ws);
 void WS_Reset(struct ws *ws, char *p);
-char *WS_Alloc(struct ws *ws, unsigned bytes);
+void *WS_Alloc(struct ws *ws, unsigned bytes);
 void *WS_Copy(struct ws *ws, const void *str, int len);
 char *WS_Snapshot(struct ws *ws);
 int WS_Overflowed(const struct ws *ws);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index eca1eee..030ccbf 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -522,7 +522,7 @@ ESI_DeliverChild(struct req *req)
 	 */
 
 	memset(tailbuf, 0xdd, sizeof tailbuf);
-	dbits = (void*)WS_Alloc(req->ws, 8);
+	dbits = WS_Alloc(req->ws, 8);
 	AN(dbits);
 	ll = 0;
 	oi = ObjIterBegin(req->wrk, req->objcore);
diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index ab2a4f5..1956a18 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -1045,7 +1045,7 @@ VEP_Init(struct vfp_ctx *vc, const struct http *req, vep_callback_t *cb,
 
 	CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(req, HTTP_MAGIC);
-	vep = (void*)WS_Alloc(vc->http->ws, sizeof *vep);
+	vep = WS_Alloc(vc->http->ws, sizeof *vep);
 	AN(vep);
 
 	memset(vep, 0, sizeof *vep);
diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index e2d9796..5859bd6 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -201,7 +201,7 @@ VFP_Push(struct vfp_ctx *vc, const struct vfp *vfp, int top)
 
 	CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(vc->http, HTTP_MAGIC);
-	vfe = (void*)WS_Alloc(vc->http->ws, sizeof *vfe);
+	vfe = WS_Alloc(vc->http->ws, sizeof *vfe);
 	AN(vfe);
 	vfe->magic = VFP_ENTRY_MAGIC;
 	vfe->vfp = vfp;
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 001dad7..c2a0836 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -86,7 +86,7 @@ ses_new(struct sesspool *pp)
 	p = (void*)PRNDUP(p);
 	assert(p < e);
 	WS_Init(sp->ws, "ses", p, e - p);
-	sp->addrs = (void*)WS_Alloc(sp->ws, vsa_suckaddr_len * 2);
+	sp->addrs = WS_Alloc(sp->ws, vsa_suckaddr_len * 2);
 
 	sp->t_open = NAN;
 	sp->t_idle = NAN;
diff --git a/bin/varnishd/cache/cache_wrw.c b/bin/varnishd/cache/cache_wrw.c
index cc02bbf..814a791 100644
--- a/bin/varnishd/cache/cache_wrw.c
+++ b/bin/varnishd/cache/cache_wrw.c
@@ -79,7 +79,7 @@ WRW_Reserve(struct worker *wrk, int *fd, struct vsl_log *vsl, double t0)
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	AZ(wrk->wrw);
-	wrw = (void*)WS_Alloc(wrk->aws, sizeof *wrw);
+	wrw = WS_Alloc(wrk->aws, sizeof *wrw);
 	AN(wrw);
 	memset(wrw, 0, sizeof *wrw);
 	wrw->magic = WRW_MAGIC;
diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c
index 91613b5..42e6121 100644
--- a/bin/varnishd/cache/cache_ws.c
+++ b/bin/varnishd/cache/cache_ws.c
@@ -114,7 +114,7 @@ WS_Reset(struct ws *ws, char *p)
 	WS_Assert(ws);
 }
 
-char *
+void *
 WS_Alloc(struct ws *ws, unsigned bytes)
 {
 	char *r;



More information about the varnish-commit mailing list