MEDIUM: channel: make channel_slow_realign() take a swap buffer
The few call places where it's used can use the trash as a swap buffer,
which is made for this exact purpose. This way we can rely on the
generic b_slow_realign() call.
diff --git a/src/hlua.c b/src/hlua.c
index cdb5ff6..f817006 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -3041,7 +3041,7 @@
* detects a non contiguous buffer and realign it.
*/
if (bi_space_for_replace(chn->buf) < max)
- channel_slow_realign(chn);
+ channel_slow_realign(chn, trash.str);
/* Copy input data in the buffer. */
max = buffer_replace2(chn->buf, chn->buf->p, chn->buf->p, str + l, max);
diff --git a/src/proto_http.c b/src/proto_http.c
index a4db33a..67598e5 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -1652,7 +1652,7 @@
}
if (unlikely(bi_end(req->buf) < b_ptr(req->buf, msg->next) ||
bi_end(req->buf) > req->buf->data + req->buf->size - global.tune.maxrewrite))
- channel_slow_realign(req);
+ channel_slow_realign(req, trash.str);
}
if (likely(msg->next < req->buf->i)) /* some unparsed data are available */
@@ -5139,7 +5139,7 @@
if (unlikely(bi_end(rep->buf) < b_ptr(rep->buf, msg->next) ||
bi_end(rep->buf) > rep->buf->data + rep->buf->size - global.tune.maxrewrite))
- channel_slow_realign(rep);
+ channel_slow_realign(rep, trash.str);
if (likely(msg->next < rep->buf->i))
http_msg_analyzer(msg, &txn->hdr_idx);
@@ -9517,7 +9517,7 @@
*/
if (s->req.buf->p > s->req.buf->data &&
s->req.buf->i + s->req.buf->p > s->req.buf->data + s->req.buf->size - global.tune.maxrewrite)
- channel_slow_realign(&s->req);
+ channel_slow_realign(&s->req, trash.str);
if (unlikely(txn->req.msg_state < HTTP_MSG_BODY)) {
if (msg->msg_state == HTTP_MSG_ERROR)