From: Amaury Denoyelle Date: Tue, 31 May 2022 09:44:25 +0000 (+0200) Subject: MINOR: ncbuf: adjust ncb_data with NCBUF_NULL X-Git-Tag: v2.6.0~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1194db24bc05e202e5ee83292880c040a9053b06;p=thirdparty%2Fhaproxy.git MINOR: ncbuf: adjust ncb_data with NCBUF_NULL Replace ncb_blk_is_null() by ncb_is_null() as a prelude to ncb_data(). The result is the same : the function will return 0 if the buffer is uninitialized. However, it is clearer to directly call ncb_is_null() to reflect this. There is no functional change with this commit. --- diff --git a/src/ncbuf.c b/src/ncbuf.c index d0ced6d217..1944cfe34f 100644 --- a/src/ncbuf.c +++ b/src/ncbuf.c @@ -494,12 +494,15 @@ int ncb_is_full(const struct ncbuf *buf) */ ncb_sz_t ncb_data(const struct ncbuf *buf, ncb_sz_t off) { - struct ncb_blk blk = ncb_blk_find(buf, off); - ncb_sz_t off_blk = ncb_blk_off(blk, off); + struct ncb_blk blk; + ncb_sz_t off_blk; - if (ncb_blk_is_null(blk)) + if (ncb_is_null(buf)) return 0; + blk = ncb_blk_find(buf, off); + off_blk = ncb_blk_off(blk, off); + /* if at the frontier between two and is gap, retrieve the * next data block. */