MINOR: buffer: make b_getblk_nc() take const pointers
Now that there are no more users requiring to modify the buffer anymore, switch these ones to const char and const buffer. This will make it more obvious next time send functions are tempted to modify the buffer's output count. Minor adaptations were necessary at a few call places which were using char due to the function's previous prototype.
This commit is contained in:
parent
5d7d1bbd0e
commit
206ba834ef
|
@ -352,7 +352,7 @@ static inline size_t b_getblk(const struct buffer *buf, char *blk, size_t len, s
|
|||
* =0 : not enough data available. <blk*> are left undefined.
|
||||
* The buffer is left unaffected. Unused buffers are left in an undefined state.
|
||||
*/
|
||||
static inline size_t b_getblk_nc(struct buffer *buf, char **blk1, int *len1, char **blk2, int *len2, size_t ofs, size_t max)
|
||||
static inline size_t b_getblk_nc(const struct buffer *buf, const char **blk1, int *len1, const char **blk2, int *len2, size_t ofs, size_t max)
|
||||
{
|
||||
size_t l1;
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ int ci_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2,
|
|||
int co_inject(struct channel *chn, const char *msg, int len);
|
||||
int co_getline(const struct channel *chn, char *str, int len);
|
||||
int co_getblk(const struct channel *chn, char *blk, int len, int offset);
|
||||
int co_getline_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
|
||||
int co_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2);
|
||||
int co_getline_nc(const struct channel *chn, const char **blk1, int *len1, const char **blk2, int *len2);
|
||||
int co_getblk_nc(const struct channel *chn, const char **blk1, int *len1, const char **blk2, int *len2);
|
||||
|
||||
|
||||
/* returns a pointer to the stream the channel belongs to */
|
||||
|
|
|
@ -312,7 +312,7 @@ int co_getblk(const struct channel *chn, char *blk, int len, int offset)
|
|||
* The channel status is not changed. The caller must call co_skip() to
|
||||
* update it. Unused buffers are left in an undefined state.
|
||||
*/
|
||||
int co_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2, int *len2)
|
||||
int co_getblk_nc(const struct channel *chn, const char **blk1, int *len1, const char **blk2, int *len2)
|
||||
{
|
||||
if (unlikely(chn->buf->o == 0)) {
|
||||
if (chn->flags & CF_SHUTW)
|
||||
|
@ -333,8 +333,8 @@ int co_getblk_nc(const struct channel *chn, char **blk1, int *len1, char **blk2,
|
|||
* the '\n'. Unused buffers are left in an undefined state.
|
||||
*/
|
||||
int co_getline_nc(const struct channel *chn,
|
||||
char **blk1, int *len1,
|
||||
char **blk2, int *len2)
|
||||
const char **blk1, int *len1,
|
||||
const char **blk2, int *len2)
|
||||
{
|
||||
int retcode;
|
||||
int l;
|
||||
|
|
24
src/hlua.c
24
src/hlua.c
|
@ -1738,9 +1738,9 @@ __LJMP static int hlua_socket_receive_yield(struct lua_State *L, int status, lua
|
|||
struct appctx *appctx;
|
||||
int len;
|
||||
int nblk;
|
||||
char *blk1;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
char *blk2;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
int skip_at_end = 0;
|
||||
struct channel *oc;
|
||||
|
@ -3633,9 +3633,9 @@ __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KC
|
|||
struct hlua_appctx *appctx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
|
||||
struct stream_interface *si = appctx->appctx->owner;
|
||||
int ret;
|
||||
char *blk1;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
char *blk2;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
|
||||
/* Read the maximum amount of data avalaible. */
|
||||
|
@ -3688,9 +3688,9 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
|
|||
struct stream_interface *si = appctx->appctx->owner;
|
||||
int len = MAY_LJMP(luaL_checkinteger(L, 2));
|
||||
int ret;
|
||||
char *blk1;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
char *blk2;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
|
||||
/* Read the maximum amount of data avalaible. */
|
||||
|
@ -4096,9 +4096,9 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K
|
|||
struct stream_interface *si = appctx->appctx->owner;
|
||||
struct channel *chn = si_ic(si);
|
||||
int ret;
|
||||
char *blk1;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
char *blk2;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
|
||||
/* Maybe we cant send a 100-continue ? */
|
||||
|
@ -4182,9 +4182,9 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon
|
|||
int len = MAY_LJMP(luaL_checkinteger(L, 2));
|
||||
struct channel *chn = si_ic(si);
|
||||
int ret;
|
||||
char *blk1;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
char *blk2;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
|
||||
/* Maybe we cant send a 100-continue ? */
|
||||
|
@ -6626,9 +6626,9 @@ static void hlua_applet_http_fct(struct appctx *ctx)
|
|||
struct act_rule *rule = ctx->rule;
|
||||
struct proxy *px = strm->be;
|
||||
struct hlua *hlua = ctx->ctx.hlua_apphttp.hlua;
|
||||
char *blk1;
|
||||
const char *blk1;
|
||||
int len1;
|
||||
char *blk2;
|
||||
const char *blk2;
|
||||
int len2;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -2945,7 +2945,7 @@ static int h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, int count)
|
|||
* number of bytes sent. The caller must check the stream's status to detect
|
||||
* any error which might have happened subsequently to a successful send.
|
||||
*/
|
||||
static size_t h2s_frt_make_resp_headers(struct h2s *h2s, struct buffer *buf, size_t ofs, size_t max)
|
||||
static size_t h2s_frt_make_resp_headers(struct h2s *h2s, const struct buffer *buf, size_t ofs, size_t max)
|
||||
{
|
||||
struct http_hdr list[MAX_HTTP_HDR];
|
||||
struct h2c *h2c = h2s->h2c;
|
||||
|
@ -3118,7 +3118,7 @@ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, struct buffer *buf, siz
|
|||
* the number of bytes sent. The caller must check the stream's status to
|
||||
* detect any error which might have happened subsequently to a successful send.
|
||||
*/
|
||||
static size_t h2s_frt_make_resp_data(struct h2s *h2s, struct buffer *buf, size_t ofs, size_t max)
|
||||
static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf, size_t ofs, size_t max)
|
||||
{
|
||||
struct h2c *h2c = h2s->h2c;
|
||||
struct h1m *h1m = &h2s->res;
|
||||
|
@ -3127,7 +3127,7 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, struct buffer *buf, size_t
|
|||
size_t total = 0;
|
||||
int es_now = 0;
|
||||
int size = 0;
|
||||
char *blk1, *blk2;
|
||||
const char *blk1, *blk2;
|
||||
int len1, len2;
|
||||
|
||||
if (h2c_mux_busy(h2c, h2s)) {
|
||||
|
|
Loading…
Reference in New Issue