From: phk Date: Tue, 25 Sep 2007 07:06:18 +0000 (+0000) Subject: Const'ifcation X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94c1f23623ce497952744d9a8bd7050c32a7a7b3;p=varnish Const'ifcation git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2018 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 56b9c77c..9c98ec36 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -401,7 +401,7 @@ void VBE_ReleaseConn(struct vbe_conn *); void VBE_UpdateHealth(struct sess *sp, struct vbe_conn *, int); /* convenience functions for backend methods */ -int VBE_TryConnect(struct sess *sp, struct addrinfo *ai); +int VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai); int VBE_CheckFd(int fd); /* cache_backend_simple.c */ @@ -435,9 +435,9 @@ int EXP_NukeOne(struct sess *sp); int Fetch(struct sess *sp); /* cache_hash.c */ -void HSH_Prealloc(struct sess *sp); -int HSH_Compare(struct sess *sp, struct objhead *o); -void HSH_Copy(struct sess *sp, struct objhead *o); +void HSH_Prealloc(const struct sess *sp); +int HSH_Compare(const struct sess *sp, const struct objhead *o); +void HSH_Copy(struct sess *sp, const struct objhead *o); struct object *HSH_Lookup(struct sess *sp); void HSH_Unbusy(struct object *o); void HSH_Ref(struct object *o); @@ -449,9 +449,9 @@ const char *http_StatusMessage(int); void HTTP_Init(void); void http_ClrHeader(struct http *to); unsigned http_Write(struct worker *w, struct http *hp, int resp); -void http_CopyResp(struct http *to, struct http *fm); +void http_CopyResp(struct http *to, const struct http *fm); void http_SetResp(struct http *to, const char *proto, const char *status, const char *response); -void http_FilterFields(struct worker *w, int fd, struct http *to, struct http *fm, unsigned how); +void http_FilterFields(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned how); void http_FilterHeader(struct sess *sp, unsigned how); void http_PutProtocol(struct worker *w, int fd, struct http *to, const char *protocol); void http_PutStatus(struct worker *w, int fd, struct http *to, int status); @@ -460,11 +460,11 @@ void http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fm void http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr); void http_SetH(struct http *to, unsigned n, const char *fm); void http_Setup(struct http *ht, void *space, unsigned len); -int http_GetHdr(struct http *hp, const char *hdr, char **ptr); -int http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr); -int http_GetStatus(struct http *hp); -const char *http_GetReq(struct http *hp); -const char *http_GetProto(struct http *hp); +int http_GetHdr(const struct http *hp, const char *hdr, char **ptr); +int http_GetHdrField(const struct http *hp, const char *hdr, const char *field, char **ptr); +int http_GetStatus(const struct http *hp); +const char *http_GetReq(const struct http *hp); +const char *http_GetProto(const struct http *hp); int http_HdrIs(struct http *hp, const char *hdr, const char *val); int http_GetTail(struct http *hp, unsigned len, char **b, char **e); int http_Read(struct http *hp, int fd, void *b, unsigned len); diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index 5becc136..141fd052 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -62,7 +62,7 @@ struct backendlist backendlist = TAILQ_HEAD_INITIALIZER(backendlist); */ int -VBE_TryConnect(struct sess *sp, struct addrinfo *ai) +VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai) { struct sockaddr_storage ss; int fam, sockt, proto; @@ -337,7 +337,7 @@ VBE_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int a) /*--------------------------------------------------------------------*/ static void -VBE_AddBackendMethod(struct backend_method *bem) +VBE_AddBackendMethod(const struct backend_method *bem) { if (bem->init != NULL) diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index c0ef0e8e..b62bfa7d 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -49,7 +49,7 @@ /*--------------------------------------------------------------------*/ static int -fetch_straight(struct sess *sp, int fd, struct http *hp, char *b) +fetch_straight(struct sess *sp, int fd, struct http *hp, const char *b) { int i; unsigned char *p; diff --git a/varnish-cache/bin/varnishd/cache_hash.c b/varnish-cache/bin/varnishd/cache_hash.c index b4726af7..27c17923 100644 --- a/varnish-cache/bin/varnishd/cache_hash.c +++ b/varnish-cache/bin/varnishd/cache_hash.c @@ -67,7 +67,7 @@ static struct hash_slinger *hash; /* Precreate an objhead and object for later use */ void -HSH_Prealloc(struct sess *sp) +HSH_Prealloc(const struct sess *sp) { struct worker *w; @@ -110,7 +110,7 @@ HSH_Freestore(struct object *o) } int -HSH_Compare(struct sess *sp, struct objhead *obj) +HSH_Compare(const struct sess *sp, const struct objhead *obj) { int i; unsigned u, v; @@ -138,7 +138,7 @@ HSH_Compare(struct sess *sp, struct objhead *obj) } void -HSH_Copy(struct sess *sp, struct objhead *obj) +HSH_Copy(struct sess *sp, const struct objhead *obj) { unsigned u, v; char *b; diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index db92f9f1..485e768b 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -79,7 +79,7 @@ static enum shmlogtag logmtx[3][7] = { }; static enum shmlogtag -http2shmlog(struct http *hp, enum httptag t) +http2shmlog(const struct http *hp, enum httptag t) { CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); @@ -89,7 +89,7 @@ http2shmlog(struct http *hp, enum httptag t) } static void -WSLH(struct worker *w, enum httptag t, unsigned fd, struct http *hp, int hdr) +WSLH(struct worker *w, enum httptag t, unsigned fd, const struct http *hp, int hdr) { WSLR(w, http2shmlog(hp, t), fd, hp->hd[hdr].b, hp->hd[hdr].e); @@ -174,7 +174,7 @@ http_Setup(struct http *hp, void *space, unsigned len) static int -http_IsHdr(struct http_hdr *hh, const char *hdr) +http_IsHdr(const struct http_hdr *hh, const char *hdr) { unsigned l; @@ -191,7 +191,7 @@ http_IsHdr(struct http_hdr *hh, const char *hdr) /*--------------------------------------------------------------------*/ static unsigned -http_findhdr(struct http *hp, unsigned l, const char *hdr) +http_findhdr(const struct http *hp, unsigned l, const char *hdr) { unsigned u; @@ -210,7 +210,7 @@ http_findhdr(struct http *hp, unsigned l, const char *hdr) } int -http_GetHdr(struct http *hp, const char *hdr, char **ptr) +http_GetHdr(const struct http *hp, const char *hdr, char **ptr) { unsigned u, l; char *p; @@ -234,7 +234,7 @@ http_GetHdr(struct http *hp, const char *hdr, char **ptr) /*--------------------------------------------------------------------*/ int -http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr) +http_GetHdrField(const struct http *hp, const char *hdr, const char *field, char **ptr) { char *h; int fl; @@ -373,7 +373,7 @@ http_Read(struct http *hp, int fd, void *p, unsigned len) /*--------------------------------------------------------------------*/ int -http_GetStatus(struct http *hp) +http_GetStatus(const struct http *hp) { AN(hp->hd[HTTP_HDR_STATUS].b); @@ -382,14 +382,14 @@ http_GetStatus(struct http *hp) } const char * -http_GetProto(struct http *hp) +http_GetProto(const struct http *hp) { AN(hp->hd[HTTP_HDR_PROTO].b); return (hp->hd[HTTP_HDR_PROTO].b); } const char * -http_GetReq(struct http *hp) +http_GetReq(const struct http *hp) { AN(hp->hd[HTTP_HDR_REQ].b); return (hp->hd[HTTP_HDR_REQ].b); @@ -704,7 +704,7 @@ http_SetH(struct http *to, unsigned n, const char *fm) } static void -http_copyh(struct http *to, struct http *fm, unsigned n) +http_copyh(struct http *to, const struct http *fm, unsigned n) { assert(n < HTTP_HDR_MAX); @@ -715,7 +715,7 @@ http_copyh(struct http *to, struct http *fm, unsigned n) } static void -http_copyreq(struct http *to, struct http *fm, int transparent) +http_copyreq(struct http *to, const struct http *fm, int transparent) { CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); @@ -732,7 +732,7 @@ http_copyreq(struct http *to, struct http *fm, int transparent) } void -http_CopyResp(struct http *to, struct http *fm) +http_CopyResp(struct http *to, const struct http *fm) { CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); @@ -756,7 +756,7 @@ http_SetResp(struct http *to, const char *proto, const char *status, const char } static void -http_copyheader(struct worker *w, int fd, struct http *to, struct http *fm, unsigned n) +http_copyheader(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned n) { CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); @@ -776,7 +776,7 @@ http_copyheader(struct worker *w, int fd, struct http *to, struct http *fm, unsi /*--------------------------------------------------------------------*/ void -http_FilterFields(struct worker *w, int fd, struct http *to, struct http *fm, unsigned how) +http_FilterFields(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned how) { unsigned u; diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index 28d190e2..713b42e3 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -75,7 +75,7 @@ VRT_count(struct sess *sp, unsigned u) /*--------------------------------------------------------------------*/ static struct http * -vrt_selecthttp(struct sess *sp, enum gethdr_e where) +vrt_selecthttp(const struct sess *sp, enum gethdr_e where) { struct http *hp; diff --git a/varnish-cache/bin/varnishd/rfc2616.c b/varnish-cache/bin/varnishd/rfc2616.c index d832b2d6..a47b09b5 100644 --- a/varnish-cache/bin/varnishd/rfc2616.c +++ b/varnish-cache/bin/varnishd/rfc2616.c @@ -99,7 +99,7 @@ #endif static double -RFC2616_Ttl(struct sess *sp, struct http *hp, struct object *obj) +RFC2616_Ttl(const struct sess *sp, struct http *hp, struct object *obj) { int retirement_age; unsigned u1, u2; diff --git a/varnish-cache/bin/varnishd/stevedore.c b/varnish-cache/bin/varnishd/stevedore.c index 88bbb295..c54db3b8 100644 --- a/varnish-cache/bin/varnishd/stevedore.c +++ b/varnish-cache/bin/varnishd/stevedore.c @@ -92,7 +92,7 @@ STV_free(struct storage *st) } static int -cmp_storage(struct stevedore *s, const char *p, const char *q) +cmp_storage(const struct stevedore *s, const const char *p, const char *q) { if (strlen(s->name) != q - p) return (1);