]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: buffer: remove the check for output on b_del()
authorWilly Tarreau <w@1wt.eu>
Mon, 9 Jul 2018 09:39:49 +0000 (11:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:43 +0000 (16:23 +0200)
b_del() is used in :
  - mux_h2 with the demux buffer : always processes input data
  - checks with output data though output is not considered at all there
  - b_eat() which is not used anywhere
  - co_skip() where the len is always <= output

Thus the distinction for output data is not needed anymore and the
decrement can be made inconditionally in co_skip().

include/common/buf.h
include/proto/channel.h

index 02a66b36662763a9bc3e7206bbe977af47d0a81e..6eec42292907697b8329ba924d9b70e7385c8c21 100644 (file)
@@ -396,10 +396,6 @@ static inline void b_set_data(struct buffer *b, size_t len)
  */
 static inline void b_del(struct buffer *b, size_t del)
 {
-       if (del >= b->output)
-               b->output = 0;
-       else
-               b->output -= del;
        b->len  -= del;
        b->head += del;
        if (b->head >= b->size)
index 291bb08f886621a1c057bff9870d0ac603a4fcaa..6241237996a0870f3db29a1eb3b7a94d8dadaa9f 100644 (file)
@@ -767,6 +767,7 @@ static inline void channel_slow_realign(struct channel *chn, char *swap)
 static inline void co_skip(struct channel *chn, int len)
 {
        b_del(chn->buf, len);
+       chn->buf->output -= len;
        c_realign_if_empty(chn);
 
        /* notify that some data was written to the SI from the buffer */