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.
This commit is contained in:
Amaury Denoyelle 2022-05-31 11:44:25 +02:00
parent cd50e7673f
commit 1194db24bc

View File

@ -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 <off> at the frontier between two and <blk> is gap, retrieve the
* next data block.
*/