[master] 2b6d5a5 Make the various http_Get* functions return const char * to what they find.

Poul-Henning Kamp phk at FreeBSD.org
Sun Sep 28 19:53:46 CEST 2014


commit 2b6d5a5f5e7e2064e14aa54162909ae5bffd8416
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sun Sep 28 17:22:51 2014 +0000

    Make the various http_Get* functions return const char * to what they find.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index fda22a1..a92b011 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -876,11 +876,11 @@ void http_SetH(const struct http *to, unsigned n, const char *fm);
 void http_ForceField(const struct http *to, unsigned n, const char *t);
 void HTTP_Setup(struct http *, struct ws *, struct vsl_log *, enum VSL_tag_e);
 void http_Teardown(struct http *ht);
-int http_GetHdr(const struct http *hp, const char *hdr, char **ptr);
+int http_GetHdr(const struct http *hp, const char *hdr, const char **ptr);
 int http_GetHdrToken(const struct http *hp, const char *hdr,
-    const char *token, char **ptr);
+    const char *token, const char **ptr);
 int http_GetHdrField(const struct http *hp, const char *hdr,
-    const char *field, char **ptr);
+    const char *field, const char **ptr);
 double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field);
 ssize_t http_GetContentLength(const struct http *hp);
 uint16_t http_GetStatus(const struct http *hp);
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index daa040f..e0a765f 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -832,7 +832,7 @@ ban_evaluate(struct worker *wrk, const uint8_t *bs, struct objcore *oc,
 {
 	struct ban_test bt;
 	const uint8_t *be;
-	char *p;
+	const char *p;
 	const char *arg1;
 
 	be = bs + ban_len(bs);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index f680f02..8ac532a 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -94,7 +94,7 @@ static int
 vbf_beresp2obj(struct busyobj *bo)
 {
 	unsigned l, l2;
-	char *b;
+	const char *b;
 	uint8_t *bp;
 	struct vsb *vary = NULL;
 	int varyl = 0;
@@ -501,7 +501,7 @@ vbf_fetch_body_helper(struct busyobj *bo)
 static enum fetch_step
 vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
 {
-	char *p;
+	const char *p;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 15605e1..8462ceb 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -377,7 +377,7 @@ http_CollectHdr(struct http *hp, const char *hdr)
 /*--------------------------------------------------------------------*/
 
 int
-http_GetHdr(const struct http *hp, const char *hdr, char **ptr)
+http_GetHdr(const struct http *hp, const char *hdr, const char **ptr)
 {
 	unsigned u, l;
 	char *p;
@@ -420,9 +420,9 @@ http_GetHdr(const struct http *hp, const char *hdr, char **ptr)
 
 int
 http_GetHdrToken(const struct http *hp, const char *hdr,
-    const char *token, char **ptr)
+    const char *token, const char **ptr)
 {
-	char *h, *e;
+	const char *h, *e;
 	unsigned fl;
 	int quoted;
 
@@ -468,7 +468,7 @@ http_GetHdrToken(const struct http *hp, const char *hdr,
 double
 http_GetHdrQ(const struct http *hp, const char *hdr, const char *field)
 {
-	char *h;
+	const char *h;
 	int i;
 	double a, b;
 
@@ -517,9 +517,9 @@ http_GetHdrQ(const struct http *hp, const char *hdr, const char *field)
 
 int
 http_GetHdrField(const struct http *hp, const char *hdr,
-    const char *field, char **ptr)
+    const char *field, const char **ptr)
 {
-	char *h;
+	const char *h;
 	int i;
 
 	if (ptr != NULL)
@@ -550,7 +550,7 @@ ssize_t
 http_GetContentLength(const struct http *hp)
 {
 	ssize_t cl, cll;
-	char *b;
+	const char *b;
 
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 
@@ -579,7 +579,7 @@ http_GetContentLength(const struct http *hp)
 enum sess_close
 http_DoConnection(struct http *hp)
 {
-	char *p, *q;
+	const char *p, *q;
 	enum sess_close retval;
 	unsigned u;
 
@@ -618,7 +618,7 @@ http_DoConnection(struct http *hp)
 int
 http_HdrIs(const struct http *hp, const char *hdr, const char *val)
 {
-	char *p;
+	const char *p;
 
 	if (!http_GetHdr(hp, hdr, &p))
 		return (0);
diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c
index 3eb10d6..766e493 100644
--- a/bin/varnishd/cache/cache_http1_deliver.c
+++ b/bin/varnishd/cache/cache_http1_deliver.c
@@ -230,7 +230,7 @@ V1D_FlushReleaseAcct(struct req *req)
 void
 V1D_Deliver(struct req *req, struct busyobj *bo)
 {
-	char *r;
+	const char *r;
 	enum objiter_status ois;
 	ssize_t l;
 
@@ -369,7 +369,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
 void
 V1D_Deliver_Synth(struct req *req)
 {
-	char *r;
+	const char *r;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	AN(req->synth_body);
diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c
index 3bbe277..8e4508a 100644
--- a/bin/varnishd/cache/cache_http1_fsm.c
+++ b/bin/varnishd/cache/cache_http1_fsm.c
@@ -260,7 +260,7 @@ http1_dissect(struct worker *wrk, struct req *req)
 	const char *r_100 = "HTTP/1.1 100 Continue\r\n\r\n";
 	const char *r_400 = "HTTP/1.1 400 Bad Request\r\n\r\n";
 	const char *r_417 = "HTTP/1.1 417 Expectation Failed\r\n\r\n";
-	char *p;
+	const char *p;
 	ssize_t r;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
diff --git a/bin/varnishd/cache/cache_http1_proto.c b/bin/varnishd/cache/cache_http1_proto.c
index ded7702..6bfa53b 100644
--- a/bin/varnishd/cache/cache_http1_proto.c
+++ b/bin/varnishd/cache/cache_http1_proto.c
@@ -382,7 +382,7 @@ static enum body_status
 http1_body_status(const struct http *hp, struct http_conn *htc)
 {
 	ssize_t cl;
-	char *b;
+	const char *b;
 
 	CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 3d20e43..bba2dea 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -680,7 +680,7 @@ cnt_recv(struct worker *wrk, struct req *req)
 {
 	unsigned recv_handling;
 	struct SHA256Context sha256ctx;
-	char *xff;
+	const char *xff;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
diff --git a/bin/varnishd/cache/cache_rfc2616.c b/bin/varnishd/cache/cache_rfc2616.c
index 99de23f..7c086b9 100644
--- a/bin/varnishd/cache/cache_rfc2616.c
+++ b/bin/varnishd/cache/cache_rfc2616.c
@@ -67,7 +67,7 @@ RFC2616_Ttl(struct busyobj *bo, double now)
 {
 	unsigned max_age, age;
 	double h_date, h_expires;
-	char *p;
+	const char *p;
 	const struct http *hp;
 	struct exp *expp;
 
@@ -214,7 +214,7 @@ RFC2616_Req_Gzip(const struct http *hp)
 int
 RFC2616_Do_Cond(const struct req *req)
 {
-	char *p, *e;
+	const char *p, *e;
 	double ims, lm;
 	int do_cond = 0;
 
@@ -246,7 +246,7 @@ RFC2616_Do_Cond(const struct req *req)
 void
 RFC2616_Weaken_Etag(struct http *hp)
 {
-	char *p;
+	const char *p;
 
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 
@@ -264,7 +264,7 @@ RFC2616_Weaken_Etag(struct http *hp)
 void
 RFC2616_Vary_AE(struct http *hp)
 {
-	char *vary;
+	const char *vary;
 
 	if (http_GetHdrToken(hp, H_Vary, "Accept-Encoding", NULL))
 		return;
diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c
index 7c783af..492af99 100644
--- a/bin/varnishd/cache/cache_vary.c
+++ b/bin/varnishd/cache/cache_vary.c
@@ -77,7 +77,7 @@ static unsigned VRY_Validate(const uint8_t *vary);
 int
 VRY_Create(struct busyobj *bo, struct vsb **psb)
 {
-	char *v, *p, *q, *h, *e;
+	const char *v, *p, *q, *h, *e;
 	struct vsb *sb, *sbh;
 	unsigned l;
 	int error = 0;
@@ -286,7 +286,7 @@ int
 VRY_Match(struct req *req, const uint8_t *vary)
 {
 	uint8_t *vsp = req->vary_b;
-	char *h, *e;
+	const char *h, *e;
 	unsigned lh, ln;
 	int i, oflo = 0;
 
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index b45cdf9..c41bcaa 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -120,7 +120,7 @@ vrt_selecthttp(VRT_CTX, enum gethdr_e where)
 const char *
 VRT_GetHdr(VRT_CTX, const struct gethdr_s *hs)
 {
-	char *p;
+	const char *p;
 	struct http *hp;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);



More information about the varnish-commit mailing list