]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: buffers: Remove buffer_bounce_realign function
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Mar 2017 09:53:34 +0000 (11:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 31 Mar 2017 12:38:22 +0000 (14:38 +0200)
Not used anymore since last commit.

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

index 3a6dfd7f08187661ebe53931efafae34651fde51..578d4b15d2b8d71c305a274605cf77a1874d8dec 100644 (file)
@@ -57,7 +57,6 @@ int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int
 int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len);
 void buffer_dump(FILE *o, struct buffer *b, int from, int to);
 void buffer_slow_realign(struct buffer *buf);
-void buffer_bounce_realign(struct buffer *buf);
 
 /*****************************************************************/
 /* These functions are used to compute various buffer area sizes */
index 4f8f6474c168d29ff7b63513169d228e71202773..3f3a198cac0cc752ec32f8184a76fca2cfa911c7 100644 (file)
@@ -176,69 +176,6 @@ void buffer_slow_realign(struct buffer *buf)
        buf->p = buf->data;
 }
 
-
-/* Realigns a possibly non-contiguous buffer by bouncing bytes from source to
- * destination. It does not use any intermediate buffer and does the move in
- * place, though it will be slower than a simple memmove() on contiguous data,
- * so it's desirable to use it only on non-contiguous buffers. No pointers are
- * changed, the caller is responsible for that.
- */
-void buffer_bounce_realign(struct buffer *buf)
-{
-       int advance, to_move;
-       char *from, *to;
-
-       from = bo_ptr(buf);
-       advance = buf->data + buf->size - from;
-       if (!advance)
-               return;
-
-       to_move = buffer_len(buf);
-       while (to_move) {
-               char last, save;
-
-               last = *from;
-               to = from + advance;
-               if (to >= buf->data + buf->size)
-                       to -= buf->size;
-
-               while (1) {
-                       save = *to;
-                       *to  = last;
-                       last = save;
-                       to_move--;
-                       if (!to_move)
-                               break;
-
-                       /* check if we went back home after rotating a number of bytes */
-                       if (to == from)
-                               break;
-
-                       /* if we ended up in the empty area, let's walk to next place. The
-                        * empty area is either between buf->r and from or before from or
-                        * after buf->r.
-                        */
-                       if (from > bi_end(buf)) {
-                               if (to >= bi_end(buf) && to < from)
-                                       break;
-                       } else if (from < bi_end(buf)) {
-                               if (to < from || to >= bi_end(buf))
-                                       break;
-                       }
-
-                       /* we have overwritten a byte of the original set, let's move it */
-                       to += advance;
-                       if (to >= buf->data + buf->size)
-                               to -= buf->size;
-               }
-
-               from++;
-               if (from >= buf->data + buf->size)
-                       from -= buf->size;
-       }
-}
-
-
 /*
  * Dumps part or all of a buffer.
  */