1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

libdm: simplify stats nr_areas calculation (Coverity)

Remove an unneccessary conditional operator and simplify the logic
in _nr_areas:

libdm/libdm-stats.c: 501 in _nr_areas() - Control flow issues  (DEADCODE)
This commit is contained in:
Bryn M. Reeves 2015-08-10 19:18:16 +01:00
parent ec87e88c52
commit 856f9cced8

View File

@ -503,8 +503,7 @@ static uint64_t _nr_areas(uint64_t len, uint64_t step)
* treat the entire region as a single area. Any partial area at the * treat the entire region as a single area. Any partial area at the
* end of the region is treated as an additional complete area. * end of the region is treated as an additional complete area.
*/ */
return (len && step) return (len / (step ? : len)) + !!(len % step);
? (len / (step ? step : len)) + !!(len % step) : 0;
} }
static uint64_t _nr_areas_region(struct dm_stats_region *region) static uint64_t _nr_areas_region(struct dm_stats_region *region)