diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-06-11 16:02:03 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | d9537fde9944a03f48054e0f4b6a9aea7d3c2a9d (patch) | |
tree | 1f4d52653dea6867cba74e3c950d251646581822 /src/basic | |
parent | 5794614c99bdb57a405f293923bf17f24dad25e9 (diff) |
tree-wide: drop !! casts to booleans
They are not needed, because anything that is non-zero is converted
to true.
C11:
> 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the
> value compares equal to 0; otherwise, the result is 1.
https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/format-table.c | 2 | ||||
-rw-r--r-- | src/basic/verbs.c | 2 | ||||
-rw-r--r-- | src/basic/virt.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/format-table.c b/src/basic/format-table.c index 8340133be..c967642df 100644 --- a/src/basic/format-table.c +++ b/src/basic/format-table.c @@ -572,7 +572,7 @@ int table_add_many_internal(Table *t, TableDataType first_type, ...) { break; case TABLE_BOOLEAN: - buffer.b = !!va_arg(ap, int); + buffer.b = va_arg(ap, int); data = &buffer.b; break; diff --git a/src/basic/verbs.c b/src/basic/verbs.c index 743aed5e4..a52cd2ad9 100644 --- a/src/basic/verbs.c +++ b/src/basic/verbs.c @@ -81,7 +81,7 @@ int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata) { if (name) found = streq(name, verbs[i].verb); else - found = !!(verbs[i].flags & VERB_DEFAULT); + found = verbs[i].flags & VERB_DEFAULT; if (found) { verb = &verbs[i]; diff --git a/src/basic/virt.c b/src/basic/virt.c index 3b2f1b917..dfc384ede 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -57,7 +57,7 @@ static int detect_vm_cpuid(void) { if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) == 0) return VIRTUALIZATION_NONE; - hypervisor = !!(ecx & 0x80000000U); + hypervisor = ecx & 0x80000000U; if (hypervisor) { union { |