]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: buffers: remove unused function buffer_contig_space_with_res()
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Apr 2014 15:14:51 +0000 (17:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Apr 2014 15:19:22 +0000 (17:19 +0200)
This function is now unused and was dangerous. Its cousin
buffer_contig_space_res() was removed as well since it was the only
one to use it.

include/common/buffer.h
include/proto/channel.h

index 18ced917b2849c48de1a3a1ea76ba0f237e66399..2d657d1f972169085dd28866e5b7ad9e147ef12b 100644 (file)
@@ -228,29 +228,6 @@ static inline int buffer_contig_space(const struct buffer *buf)
        return right - left;
 }
 
-/* Return the amount of bytes that can be written into the buffer at once,
- * excluding the amount of reserved space passed in <res>, which is
- * preserved.
- */
-static inline int buffer_contig_space_with_res(const struct buffer *buf, int res)
-{
-       /* Proceed differently if the buffer is full, partially used or empty.
-        * The hard situation is when it's partially used and either data or
-        * reserved space wraps at the end.
-        */
-       int spare = buf->size - res;
-
-       if (buffer_len(buf) >= spare)
-               spare = 0;
-       else if (buffer_len(buf)) {
-               spare = buffer_contig_space(buf) - res;
-               if (spare < 0)
-                       spare = 0;
-       }
-       return spare;
-}
-
-
 /* Normalizes a pointer which is supposed to be relative to the beginning of a
  * buffer, so that wrapping is correctly handled. The intent is to use this
  * when increasing a pointer. Note that the wrapping test is only performed
index 36633c6432e4d7996e29197929239edfd20ff6d8..e323d340d0929e122fef6eedff9c7bea4a8b58dd 100644 (file)
@@ -280,14 +280,6 @@ static inline int buffer_max_len(const struct channel *chn)
        return chn->buf->size - buffer_reserved(chn);
 }
 
-/* Return the amount of bytes that can be written into the buffer at once,
- * excluding reserved space, which is preserved.
- */
-static inline int buffer_contig_space_res(const struct channel *chn)
-{
-       return buffer_contig_space_with_res(chn->buf, buffer_reserved(chn));
-}
-
 /* Returns the amount of space available at the input of the buffer, taking the
  * reserved space into account if ->to_forward indicates that an end of transfer
  * is close to happen. The test is optimized to avoid as many operations as