Commit b71cb6a8 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

All the _r_ object accessor functions should by definition be able to

take a "const struct req *" so enforce this.
parent 14b48c8f
...@@ -204,7 +204,7 @@ VBERESP(beresp, unsigned, do_pass, busyobj->do_pass) ...@@ -204,7 +204,7 @@ VBERESP(beresp, unsigned, do_pass, busyobj->do_pass)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
const char * const char *
VRT_r_client_identity(struct req *req) VRT_r_client_identity(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
...@@ -238,8 +238,8 @@ VRT_l_bereq_##which(struct req *req, double num) \ ...@@ -238,8 +238,8 @@ VRT_l_bereq_##which(struct req *req, double num) \
req->busyobj->which = (num > 0.0 ? num : 0.0); \ req->busyobj->which = (num > 0.0 ? num : 0.0); \
} \ } \
\ \
double __match_proto__() \ double \
VRT_r_bereq_##which(struct req *req) \ VRT_r_bereq_##which(const struct req *req) \
{ \ { \
\ \
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \ CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \
...@@ -280,8 +280,8 @@ VRT_r_beresp_backend_port(const struct req *req) ...@@ -280,8 +280,8 @@ VRT_r_beresp_backend_port(const struct req *req)
return (VTCP_port(req->busyobj->vbc->addr)); return (VTCP_port(req->busyobj->vbc->addr));
} }
const char * __match_proto__() const char *
VRT_r_beresp_storage(struct req *req) VRT_r_beresp_storage(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
if (req->storage_hint != NULL) if (req->storage_hint != NULL)
...@@ -290,7 +290,7 @@ VRT_r_beresp_storage(struct req *req) ...@@ -290,7 +290,7 @@ VRT_r_beresp_storage(struct req *req)
return (NULL); return (NULL);
} }
void __match_proto__() void
VRT_l_beresp_storage(struct req *req, const char *str, ...) VRT_l_beresp_storage(struct req *req, const char *str, ...)
{ {
va_list ap; va_list ap;
...@@ -314,7 +314,7 @@ VRT_l_req_backend(struct req *req, struct director *be) ...@@ -314,7 +314,7 @@ VRT_l_req_backend(struct req *req, struct director *be)
} }
struct director * struct director *
VRT_r_req_backend(struct req *req) VRT_r_req_backend(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
...@@ -336,7 +336,7 @@ VRT_l_req_esi(struct req *req, unsigned process_esi) ...@@ -336,7 +336,7 @@ VRT_l_req_esi(struct req *req, unsigned process_esi)
} }
unsigned unsigned
VRT_r_req_esi(struct req *req) VRT_r_req_esi(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
return (!req->disable_esi); return (!req->disable_esi);
...@@ -352,8 +352,8 @@ VRT_r_req_esi_level(const struct req *req) ...@@ -352,8 +352,8 @@ VRT_r_req_esi_level(const struct req *req)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
unsigned __match_proto__() unsigned
VRT_r_req_can_gzip(struct req *req) VRT_r_req_can_gzip(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
...@@ -378,7 +378,7 @@ VRT_r_req_restarts(const struct req *req) ...@@ -378,7 +378,7 @@ VRT_r_req_restarts(const struct req *req)
#define VRT_DO_EXP(which, exp, fld, offset, extra) \ #define VRT_DO_EXP(which, exp, fld, offset, extra) \
\ \
void __match_proto__() \ void \
VRT_l_##which##_##fld(struct req *req, double a) \ VRT_l_##which##_##fld(struct req *req, double a) \
{ \ { \
\ \
...@@ -389,8 +389,8 @@ VRT_l_##which##_##fld(struct req *req, double a) \ ...@@ -389,8 +389,8 @@ VRT_l_##which##_##fld(struct req *req, double a) \
extra; \ extra; \
} \ } \
\ \
double __match_proto__() \ double \
VRT_r_##which##_##fld(struct req *req) \ VRT_r_##which##_##fld(const struct req *req) \
{ \ { \
\ \
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \ CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \
...@@ -432,8 +432,8 @@ VRT_DO_EXP(beresp, req->busyobj->exp, keep, 0, ...@@ -432,8 +432,8 @@ VRT_DO_EXP(beresp, req->busyobj->exp, keep, 0,
* req.xid * req.xid
*/ */
const char * __match_proto__() const char *
VRT_r_req_xid(struct req *req) VRT_r_req_xid(const struct req *req)
{ {
char *p; char *p;
int size; int size;
...@@ -448,7 +448,7 @@ VRT_r_req_xid(struct req *req) ...@@ -448,7 +448,7 @@ VRT_r_req_xid(struct req *req)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
#define REQ_BOOL(hash_var) \ #define REQ_BOOL(hash_var) \
void __match_proto__() \ void \
VRT_l_req_##hash_var(struct req *req, unsigned val) \ VRT_l_req_##hash_var(struct req *req, unsigned val) \
{ \ { \
\ \
...@@ -456,8 +456,8 @@ VRT_l_req_##hash_var(struct req *req, unsigned val) \ ...@@ -456,8 +456,8 @@ VRT_l_req_##hash_var(struct req *req, unsigned val) \
req->hash_var = val ? 1 : 0; \ req->hash_var = val ? 1 : 0; \
} \ } \
\ \
unsigned __match_proto__() \ unsigned \
VRT_r_req_##hash_var(struct req *req) \ VRT_r_req_##hash_var(const struct req *req) \
{ \ { \
\ \
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \ CHECK_OBJ_NOTNULL(req, REQ_MAGIC); \
...@@ -470,7 +470,7 @@ REQ_BOOL(hash_always_miss) ...@@ -470,7 +470,7 @@ REQ_BOOL(hash_always_miss)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
struct sockaddr_storage * struct sockaddr_storage *
VRT_r_client_ip(struct req *req) VRT_r_client_ip(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
...@@ -478,7 +478,7 @@ VRT_r_client_ip(struct req *req) ...@@ -478,7 +478,7 @@ VRT_r_client_ip(struct req *req)
} }
struct sockaddr_storage * struct sockaddr_storage *
VRT_r_server_ip(struct req *req) VRT_r_server_ip(const struct req *req)
{ {
int i; int i;
...@@ -493,7 +493,7 @@ VRT_r_server_ip(struct req *req) ...@@ -493,7 +493,7 @@ VRT_r_server_ip(struct req *req)
} }
const char* const char*
VRT_r_server_identity(struct req *req) VRT_r_server_identity(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
...@@ -504,7 +504,7 @@ VRT_r_server_identity(struct req *req) ...@@ -504,7 +504,7 @@ VRT_r_server_identity(struct req *req)
} }
const char* const char*
VRT_r_server_hostname(struct req *req) VRT_r_server_hostname(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
...@@ -518,7 +518,7 @@ VRT_r_server_hostname(struct req *req) ...@@ -518,7 +518,7 @@ VRT_r_server_hostname(struct req *req)
*/ */
int int
VRT_r_server_port(struct req *req) VRT_r_server_port(const struct req *req)
{ {
int i; int i;
...@@ -552,7 +552,7 @@ VRT_r_obj_lastuse(const struct req *req) ...@@ -552,7 +552,7 @@ VRT_r_obj_lastuse(const struct req *req)
} }
unsigned unsigned
VRT_r_req_backend_healthy(struct req *req) VRT_r_req_backend_healthy(const struct req *req)
{ {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->director, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(req->director, DIRECTOR_MAGIC);
......
...@@ -833,7 +833,7 @@ for i in sp_variables: ...@@ -833,7 +833,7 @@ for i in sp_variables:
if len(i[2]) > 0: if len(i[2]) > 0:
fo.write('\t "VRT_r_%s(req)",\n' % cnam) fo.write('\t "VRT_r_%s(req)",\n' % cnam)
if typ != "HEADER": if typ != "HEADER":
fh.write(ctyp + " VRT_r_%s(%s);\n" % (cnam, i[4])) fh.write(ctyp + " VRT_r_%s(const %s);\n" % (cnam, i[4]))
else: else:
fo.write('\t NULL,\t/* No reads allowed */\n') fo.write('\t NULL,\t/* No reads allowed */\n')
restrict(fo, i[2]) restrict(fo, i[2])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment