mirror of
https://github.com/nilfs-dev/nilfs-utils.git
synced 2026-01-26 13:43:15 +00:00
libcnormap: use unsigned int for one-bit bitfields
The one-bit bitfields in 'struct nilfs_cnormap' are currently defined as 'int'. On two's complement systems, a one-bit signed integer can only represent 0 and -1, which is not suitable for boolean flags intended to hold 0 or 1. Change them to 'unsigned int' to ensure they can represent 0 and 1 correctly. While at it, clean up the comments for these members to improve readability. This resolves the following Sparse errors reported: cnormap.c:64:35: error: dubious one-bit signed bitfield cnormap.c:69:42: error: dubious one-bit signed bitfield cnormap.c:70:43: error: dubious one-bit signed bitfield Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
This commit is contained in:
parent
0628420881
commit
8e51827399
@ -61,13 +61,15 @@ struct nilfs_cnormap {
|
||||
int64_t base_time; /* Base time */
|
||||
int64_t base_clock; /* Monotonic clock at the base time */
|
||||
|
||||
int has_clock_boottime : 1; /*
|
||||
* Flag that indicates whether
|
||||
* clock_gettime(CLOCK_BOOTTIME, )
|
||||
* is supported or not on the system.
|
||||
*/
|
||||
int has_clock_realtime_coarse : 1; /* Has CLOCK_REALTIME_COARSE */
|
||||
int has_clock_monotonic_coarse : 1; /* Has CLOCK_MONOTONIC_COARSE */
|
||||
/* Clock feature flags */
|
||||
unsigned int has_clock_boottime : 1;
|
||||
/* clock_gettime(CLOCK_BOOTTIME, ) is available */
|
||||
|
||||
unsigned int has_clock_realtime_coarse : 1;
|
||||
/* CLOCK_REALTIME_COARSE is available */
|
||||
|
||||
unsigned int has_clock_monotonic_coarse : 1;
|
||||
/* CLOCK_MONOTONIC_COARSE is available */
|
||||
};
|
||||
|
||||
struct nilfs_cnormap *nilfs_cnormap_create(struct nilfs *nilfs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user