From d5b343bf9e059916eeb24b025e82e9dcb649df33 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 6 Jun 2018 06:42:46 +0200 Subject: [PATCH] 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. --- include/common/buffer.h | 9 --------- src/channel.c | 2 +- src/proto_http.c | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) 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; -- 2.47.3