BUILD: do not specify "const" on functions returning structs or scalars

Older compilers (like gcc-3.4) warn about the use of "const" on functions
returning a struct, which makes sense since the return may only be copied :

  include/common/htx.h:233: warning: type qualifiers ignored on function return type

Let's simply drop "const" here.
This commit is contained in:
Willy Tarreau 2019-04-15 21:27:18 +02:00
parent 0e492e2ad0
commit 8de1df92a3
3 changed files with 11 additions and 11 deletions

View File

@ -136,7 +136,7 @@ extern const char *HTTP_407_fmt;
int init_http(char **err); int init_http(char **err);
enum http_meth_t find_http_meth(const char *str, const int len); enum http_meth_t find_http_meth(const char *str, const int len);
const int http_get_status_idx(unsigned int status); int http_get_status_idx(unsigned int status);
const char *http_get_reason(unsigned int status); const char *http_get_reason(unsigned int status);
struct ist http_get_path(const struct ist uri); struct ist http_get_path(const struct ist uri);
int http_header_match2(const char *hdr, const char *end, int http_header_match2(const char *hdr, const char *end,

View File

@ -229,48 +229,48 @@ int htx_trailer_to_h1(const struct ist tlr, struct buffer *chk);
#define HTX_SL_RES_CPTR(sl) HTX_SL_P2_PTR(sl) #define HTX_SL_RES_CPTR(sl) HTX_SL_P2_PTR(sl)
#define HTX_SL_RES_RPTR(sl) HTX_SL_P3_PTR(sl) #define HTX_SL_RES_RPTR(sl) HTX_SL_P3_PTR(sl)
static inline const struct ist htx_sl_p1(const struct htx_sl *sl) static inline struct ist htx_sl_p1(const struct htx_sl *sl)
{ {
return ist2(HTX_SL_P1_PTR(sl), HTX_SL_P1_LEN(sl)); return ist2(HTX_SL_P1_PTR(sl), HTX_SL_P1_LEN(sl));
} }
static inline const struct ist htx_sl_p2(const struct htx_sl *sl) static inline struct ist htx_sl_p2(const struct htx_sl *sl)
{ {
return ist2(HTX_SL_P2_PTR(sl), HTX_SL_P2_LEN(sl)); return ist2(HTX_SL_P2_PTR(sl), HTX_SL_P2_LEN(sl));
} }
static inline const struct ist htx_sl_p3(const struct htx_sl *sl) static inline struct ist htx_sl_p3(const struct htx_sl *sl)
{ {
return ist2(HTX_SL_P3_PTR(sl), HTX_SL_P3_LEN(sl)); return ist2(HTX_SL_P3_PTR(sl), HTX_SL_P3_LEN(sl));
} }
static inline const struct ist htx_sl_req_meth(const struct htx_sl *sl) static inline struct ist htx_sl_req_meth(const struct htx_sl *sl)
{ {
return htx_sl_p1(sl); return htx_sl_p1(sl);
} }
static inline const struct ist htx_sl_req_uri(const struct htx_sl *sl) static inline struct ist htx_sl_req_uri(const struct htx_sl *sl)
{ {
return htx_sl_p2(sl); return htx_sl_p2(sl);
} }
static inline const struct ist htx_sl_req_vsn(const struct htx_sl *sl) static inline struct ist htx_sl_req_vsn(const struct htx_sl *sl)
{ {
return htx_sl_p3(sl); return htx_sl_p3(sl);
} }
static inline const struct ist htx_sl_res_vsn(const struct htx_sl *sl) static inline struct ist htx_sl_res_vsn(const struct htx_sl *sl)
{ {
return htx_sl_p1(sl); return htx_sl_p1(sl);
} }
static inline const struct ist htx_sl_res_code(const struct htx_sl *sl) static inline struct ist htx_sl_res_code(const struct htx_sl *sl)
{ {
return htx_sl_p2(sl); return htx_sl_p2(sl);
} }
static inline const struct ist htx_sl_res_reason(const struct htx_sl *sl) static inline struct ist htx_sl_res_reason(const struct htx_sl *sl)
{ {
return htx_sl_p3(sl); return htx_sl_p3(sl);
} }

View File

@ -362,7 +362,7 @@ enum http_meth_t find_http_meth(const char *str, const int len)
/* This function returns HTTP_ERR_<num> (enum) matching http status code. /* This function returns HTTP_ERR_<num> (enum) matching http status code.
* Returned value should match codes from http_err_codes. * Returned value should match codes from http_err_codes.
*/ */
const int http_get_status_idx(unsigned int status) int http_get_status_idx(unsigned int status)
{ {
switch (status) { switch (status) {
case 200: return HTTP_ERR_200; case 200: return HTTP_ERR_200;