cocci: simplify some if checks
This commit is contained in:
parent
a7891d203c
commit
f20db19954
|
@ -0,0 +1,54 @@
|
||||||
|
@@
|
||||||
|
expression r;
|
||||||
|
@@
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
- if (r == 0)
|
||||||
|
- return 0;
|
||||||
|
+ if (r <= 0)
|
||||||
|
+ return r;
|
||||||
|
@@
|
||||||
|
expression r;
|
||||||
|
@@
|
||||||
|
- if (r == 0)
|
||||||
|
- return 0;
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
+ if (r <= 0)
|
||||||
|
+ return r;
|
||||||
|
@@
|
||||||
|
expression r;
|
||||||
|
@@
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
- if (r == 0)
|
||||||
|
- return r;
|
||||||
|
+ if (r <= 0)
|
||||||
|
+ return r;
|
||||||
|
@@
|
||||||
|
expression r;
|
||||||
|
@@
|
||||||
|
- if (r == 0)
|
||||||
|
- return r;
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
+ if (r <= 0)
|
||||||
|
+ return r;
|
||||||
|
@@
|
||||||
|
expression r;
|
||||||
|
@@
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
- if (r > 0)
|
||||||
|
- return r;
|
||||||
|
+ if (r != 0)
|
||||||
|
+ return r;
|
||||||
|
@@
|
||||||
|
expression r;
|
||||||
|
@@
|
||||||
|
- if (r > 0)
|
||||||
|
- return r;
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
+ if (r != 0)
|
||||||
|
+ return r;
|
|
@ -199,10 +199,8 @@ int cg_rmdir(const char *controller, const char *path) {
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
r = cg_hybrid_unified();
|
r = cg_hybrid_unified();
|
||||||
if (r < 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (streq(controller, SYSTEMD_CGROUP_CONTROLLER)) {
|
if (streq(controller, SYSTEMD_CGROUP_CONTROLLER)) {
|
||||||
r = cg_rmdir(SYSTEMD_CGROUP_CONTROLLER_LEGACY, path);
|
r = cg_rmdir(SYSTEMD_CGROUP_CONTROLLER_LEGACY, path);
|
||||||
|
|
|
@ -2788,10 +2788,8 @@ static int manager_dispatch_timezone_change(
|
||||||
log_debug("inotify event for /etc/localtime");
|
log_debug("inotify event for /etc/localtime");
|
||||||
|
|
||||||
changed = manager_read_timezone_stat(m);
|
changed = manager_read_timezone_stat(m);
|
||||||
if (changed < 0)
|
if (changed <= 0)
|
||||||
return changed;
|
return changed;
|
||||||
if (!changed)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Something changed, restart the watch, to ensure we watch the new /etc/localtime if it changed */
|
/* Something changed, restart the watch, to ensure we watch the new /etc/localtime if it changed */
|
||||||
(void) manager_setup_timezone_change(m);
|
(void) manager_setup_timezone_change(m);
|
||||||
|
|
|
@ -1378,17 +1378,13 @@ static int nsec3_is_good(DnsResourceRecord *rr, DnsResourceRecord *nsec3) {
|
||||||
|
|
||||||
a = dns_resource_key_name(rr->key);
|
a = dns_resource_key_name(rr->key);
|
||||||
r = dns_name_parent(&a); /* strip off hash */
|
r = dns_name_parent(&a); /* strip off hash */
|
||||||
if (r < 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
b = dns_resource_key_name(nsec3->key);
|
b = dns_resource_key_name(nsec3->key);
|
||||||
r = dns_name_parent(&b); /* strip off hash */
|
r = dns_name_parent(&b); /* strip off hash */
|
||||||
if (r < 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Make sure both have the same parent */
|
/* Make sure both have the same parent */
|
||||||
return dns_name_equal(a, b);
|
return dns_name_equal(a, b);
|
||||||
|
@ -2096,10 +2092,8 @@ static int dnssec_test_positive_wildcard_nsec3(
|
||||||
for (;;) {
|
for (;;) {
|
||||||
next_closer = name;
|
next_closer = name;
|
||||||
r = dns_name_parent(&name);
|
r = dns_name_parent(&name);
|
||||||
if (r < 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
r = dns_name_equal(name, source);
|
r = dns_name_equal(name, source);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|
Loading…
Reference in New Issue