]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: channel/buffer: use c_realign_if_empty() instead of buffer_realign()
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Jun 2018 04:42:46 +0000 (06:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:40 +0000 (16:23 +0200)
This patch removes buffer_realign() and replaces it with c_realign_if_empty()
instead.

include/common/buffer.h
src/channel.c
src/proto_http.c

index 590078c0de19df4e82f2d4be04895863feb82486..0218afa693770d25bd398e3de55f2e1044486cb5 100644 (file)
@@ -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.
index 3770502c122618db502e1c7f6f983996c2a731f8..7235ffc4b914214e2e0f96e5edc3f315f3907407 100644 (file)
@@ -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;
index 4fd5aeb156bc51b74e30043365e9b51499ee67f3..c447929c85429440020e2631654e7f6acb2155f9 100644 (file)
@@ -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;