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/shared | |
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/shared')
-rw-r--r-- | src/shared/bus-util.c | 6 | ||||
-rw-r--r-- | src/shared/conf-parser.c | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 020fa885a..e69b53ea6 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1094,9 +1094,9 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne return r; if (flags & BUS_MAP_BOOLEAN_AS_BOOL) - * (bool*) userdata = !!b; + *(bool*) userdata = b; else - * (int*) userdata = b; + *(int*) userdata = b; return 0; } @@ -1413,7 +1413,7 @@ int bus_property_set_bool( if (r < 0) return r; - *(bool *) userdata = !!b; + *(bool*) userdata = b; return 0; } diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index db74a7fdb..a150f8940 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -50,6 +50,7 @@ //#include "rlimit-util.h" //#include "rlimit-util.h" //#include "rlimit-util.h" +//#include "rlimit-util.h" int config_item_table_lookup( const void *table, @@ -656,7 +657,7 @@ int config_parse_bool(const char* unit, return fatal ? -ENOEXEC : 0; } - *b = !!k; + *b = k; return 0; } |