]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: buffer: replace bi_fast_delete() with b_del()
authorWilly Tarreau <w@1wt.eu>
Tue, 10 Jul 2018 07:59:31 +0000 (09:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:43 +0000 (16:23 +0200)
There's no distinction between in and out data now. The latter covers
the needs of the former and supports wrapping. The extra cost is
negligible given the locations where it's used.

include/common/buffer.h
src/h1.c
src/hlua.c
src/proto_http.c

index 018b19ec30680e6ca0089898f968b389d3347708..d7bfb967e49ad0643b89c75a565ff3d497a04496 100644 (file)
@@ -104,16 +104,6 @@ static inline int buffer_almost_full(const struct buffer *buf)
        return b_almost_full(buf);
 }
 
-/* Cut the first <n> pending bytes in a contiguous buffer. The caller must
- * ensure that <n> is smaller than the actual buffer's length. This is mainly
- * used to remove empty lines at the beginning of a request or a response.
- */
-static inline void bi_fast_delete(struct buffer *buf, int n)
-{
-       buf->len  -= n;
-       buf->head += n;
-}
-
 /* This function writes the string <str> at position <pos> which must be in
  * buffer <b>, and moves <end> just after the end of <str>. <b>'s parameters
  * (l, r, lr) are updated to be valid after the shift. the shift value
index 5498f1f690b50c305212bf2a75fc3e7c2373435a..7e19679e27fe7464a77e6bc3dbcc684dbefef9f9 100644 (file)
--- a/src/h1.c
+++ b/src/h1.c
@@ -485,7 +485,7 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx)
                                if (co_data(msg->chn))
                                        goto http_msg_ood;
                                /* Remove empty leading lines, as recommended by RFC2616. */
-                               bi_fast_delete(buf, ptr - input);
+                               b_del(buf, ptr - input);
                        }
                        msg->sol = 0;
                        msg->sl.st.l = 0; /* used in debug mode */
@@ -553,7 +553,7 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx)
                                if (co_data(msg->chn))
                                        goto http_msg_ood;
                                /* Remove empty leading lines, as recommended by RFC2616. */
-                               bi_fast_delete(buf, ptr - input);
+                               b_del(buf, ptr - input);
                        }
                        msg->sol = 0;
                        msg->sl.rq.l = 0; /* used in debug mode */
index 588576c276c0bc1a1f50d631f59ac051bb87b26d..2179c61d9543fa49b27bf1811ed38a0dc7988047 100644 (file)
@@ -5405,7 +5405,7 @@ __LJMP static int hlua_txn_done(lua_State *L)
 
        if (htxn->s->txn) {
                /* HTTP mode, let's stay in sync with the stream */
-               bi_fast_delete(ic->buf, htxn->s->txn->req.sov);
+               b_del(ic->buf, htxn->s->txn->req.sov);
                htxn->s->txn->req.next -= htxn->s->txn->req.sov;
                htxn->s->txn->req.sov = 0;
                ic->analysers &= AN_REQ_HTTP_XFER_BODY;
index 37360bff90dce5a1c476e023df5240d7ed31dc45..85c2391feabe1b4845262d7bdad51fc12dce5807 100644 (file)
@@ -3385,7 +3385,7 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
                FLT_STRM_CB(s, flt_http_reply(s, txn->status, chunk));
                co_inject(res->chn, chunk->str, chunk->len);
                /* "eat" the request */
-               bi_fast_delete(req->chn->buf, req->sov);
+               b_del(req->chn->buf, req->sov);
                req->next -= req->sov;
                req->sov = 0;
                s->req.analysers = AN_REQ_HTTP_XFER_BODY | (s->req.analysers & AN_REQ_FLT_END);