From: Christopher Faulet Date: Tue, 28 Mar 2017 09:53:34 +0000 (+0200) Subject: CLEANUP: buffers: Remove buffer_bounce_realign function X-Git-Tag: v1.8-dev1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aaf4a325ca5339c09e7c1a08b857162fc1817be8;p=thirdparty%2Fhaproxy.git CLEANUP: buffers: Remove buffer_bounce_realign function Not used anymore since last commit. --- diff --git a/include/common/buffer.h b/include/common/buffer.h index 3a6dfd7f08..578d4b15d2 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -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 */ diff --git a/src/buffer.c b/src/buffer.c index 4f8f6474c1..3f3a198cac 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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. */