From: Willy Tarreau Date: Wed, 6 Jun 2018 04:42:46 +0000 (+0200) Subject: MINOR: channel/buffer: use c_realign_if_empty() instead of buffer_realign() X-Git-Tag: v1.9-dev1~158 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d5b343bf9e059916eeb24b025e82e9dcb649df33;p=thirdparty%2Fhaproxy.git MINOR: channel/buffer: use c_realign_if_empty() instead of buffer_realign() This patch removes buffer_realign() and replaces it with c_realign_if_empty() instead. --- diff --git a/include/common/buffer.h b/include/common/buffer.h index 590078c0de..0218afa693 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -394,15 +394,6 @@ static inline void bi_fast_delete(struct buffer *buf, int n) buf->p += n; } -/* Tries to realign the given buffer. */ -static inline void buffer_realign(struct buffer *buf) -{ - if (!(buf->i | buf->o)) { - /* let's realign the buffer to optimize I/O */ - buf->p = buf->data; - } -} - /* Schedule all remaining buffer data to be sent. ->o is not touched if it * already covers those data. That permits doing a flush even after a forward, * although not recommended. diff --git a/src/channel.c b/src/channel.c index 3770502c12..7235ffc4b9 100644 --- a/src/channel.c +++ b/src/channel.c @@ -91,7 +91,7 @@ int co_inject(struct channel *chn, const char *msg, int len) return -2; } - buffer_realign(chn->buf); + c_realign_if_empty(chn); max = bo_contig_space(chn->buf); if (len > max) return max; diff --git a/src/proto_http.c b/src/proto_http.c index 4fd5aeb156..c447929c85 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -8318,7 +8318,7 @@ void http_reset_txn(struct stream *s) s->res.buf->i = 0; /* Now we can realign the response buffer */ - buffer_realign(s->res.buf); + c_realign_if_empty(&s->res); s->req.rto = strm_fe(s)->timeout.client; s->req.wto = TICK_ETERNITY;