From: Amaury Denoyelle Date: Mon, 28 Feb 2022 09:00:54 +0000 (+0100) Subject: MINOR: quic: simplify copy of STREAM frames to RX buffer X-Git-Tag: v2.6-dev3~95 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d2d030522bce099e8118097b68a2babc6b4e561;p=thirdparty%2Fhaproxy.git MINOR: quic: simplify copy of STREAM frames to RX buffer qc_strm_cpy can be simplified by simply using b_putblk which already handle wrapping of the destination buffer. The function is kept to update the frame length and offset fields. --- diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 084afaeffb..a1b89c771f 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -1976,22 +1976,9 @@ static size_t qc_strm_cpy(struct buffer *buf, struct quic_stream *strm_frm) { size_t ret; - ret = 0; - while (strm_frm->len) { - size_t try; - - try = b_contig_space(buf); - if (!try) - break; - - if (try > strm_frm->len) - try = strm_frm->len; - memcpy(b_tail(buf), strm_frm->data, try); - strm_frm->len -= try; - strm_frm->offset.key += try; - b_add(buf, try); - ret += try; - } + ret = b_putblk(buf, (char *)strm_frm->data, strm_frm->len); + strm_frm->len -= ret; + strm_frm->offset.key += ret; return ret; }