From 1194db24bc05e202e5ee83292880c040a9053b06 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Tue, 31 May 2022 11:44:25 +0200 Subject: [PATCH] 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. --- src/ncbuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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. */ -- 2.47.3