tree-wide: formatting tweaks reported by Coccinelle

This commit is contained in:
Frantisek Sumsal 2020-04-21 20:23:33 +02:00
parent 33b58dfb41
commit e4ff03935c
5 changed files with 23 additions and 11 deletions

View File

@ -1,6 +1,18 @@
@@
/* Avoid running this transformation on the strempty function itself */
position p : script:python() { p[0].current_element != "strempty" };
/* Avoid running this transformation on the strempty function itself and
* on the "make_expression" macro in src/libsystemd/sd-bus/bus-convenience.c.
* As Coccinelle's Location object doesn't support macro "detection", use
* a pretty horrifying combo of specifying a file and a special "something_else"
* position element, which is, apparently, the default value of
* "current_element" before it's set (according to the source code), thus
* matching any "top level" position, including macros. Let's hope we never
* introduce a function called "something_else"...
*/
position p : script:python() {
not (p[0].current_element == "strempty" or
(p[0].file == "src/libsystemd/sd-bus/bus-convenience.c" and
p[0].current_element == "something_else"))
};
expression s;
@@
(

View File

@ -1038,10 +1038,9 @@ static int home_remove(UserRecord *h) {
if (deleted)
log_info("Everything completed.");
else {
log_notice("Nothing to remove.");
return -EALREADY;
}
else
return log_notice_errno(SYNTHETIC_ERRNO(EALREADY),
"Nothing to remove.");
return 0;
}

View File

@ -141,8 +141,8 @@ int sd_dhcp_lease_get_servers(
return (int) lease->smtp_server_size;
default:
log_debug("Uknown DHCP lease info item %d.", what);
return -ENXIO;
return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
"Uknown DHCP lease info item %d.", what);
}
}

View File

@ -1162,8 +1162,8 @@ int sd_dhcp_server_set_servers(
break;
default:
log_debug("Uknown DHCP lease info item %d.", what);
return -ENXIO;
return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
"Uknown DHCP lease info item %d.", what);
}
if (*n_a == n_addresses &&

View File

@ -1058,7 +1058,8 @@ static void verify_one(
r = unit_file_verify_alias(i, alias, &alias2);
log_info_errno(r, "alias %s ← %s: %d/%m (expected %d)%s%s%s",
i->name, alias, r, expected,
alias2 ? " [" : "", alias2 ?: "", alias2 ? "]" : "");
alias2 ? " [" : "", strempty(alias2),
alias2 ? "]" : "");
assert(r == expected);
/* This is is test for "instance propagation". This propagation matters mostly for WantedBy= and