LCOV - code coverage report
Current view: top level - src - blocks_to_bytes.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-03-01 04:31:48 Functions: 100.0 % 1 1
Branches: 100.0 % 2 2

             Branch data     Line data    Source code
       1                 :             : #include "precizer.h"
       2                 :             : 
       3                 :             : /**
       4                 :             :  * @brief Convert POSIX `st_blocks` units into bytes.
       5                 :             :  *
       6                 :             :  * @details POSIX defines `st_blocks` in 512-byte units regardless of the
       7                 :             :  * filesystem I/O block size. Some filesystems may report non-positive values
       8                 :             :  * for special files; those are normalized to zero.
       9                 :             :  *
      10                 :             :  * @param blocks Allocated block count from file metadata.
      11                 :             :  * @return Allocated bytes as `blocks * POSIX_STAT_BLOCK_BYTES`, or zero when
      12                 :             :  *         @p blocks is less than or equal to zero.
      13                 :             :  */
      14                 :        3694 : extern inline size_t blocks_to_bytes(const blkcnt_t blocks)
      15                 :             : {
      16         [ +  + ]:        3694 :         if(blocks <= 0)
      17                 :             :         {
      18                 :          20 :                 return 0;
      19                 :             :         }
      20                 :             : 
      21                 :        3674 :         return (size_t)blocks * POSIX_STAT_BLOCK_BYTES;
      22                 :             : }
        

Generated by: LCOV version 2.0-1