tree-wide: various code-formatting improvements
Reported/found by Coccinelle
This commit is contained in:
parent
1697a28567
commit
38288f0bb8
|
@ -78,7 +78,7 @@ void* greedy_realloc(void **p, size_t *allocated, size_t need, size_t size) {
|
|||
* take possession of the extra space. This should be cheap, since libc doesn't have to move
|
||||
* the memory for this. */
|
||||
|
||||
qq = realloc(q, bn * size);
|
||||
qq = reallocarray(q, bn, size);
|
||||
if (_likely_(qq)) {
|
||||
*p = qq;
|
||||
*allocated = bn;
|
||||
|
|
|
@ -345,10 +345,8 @@ int cg_kill(
|
|||
a workaround for kernel bug. It was fixed in 5.2-rc5 (c03cd7738a83), backported to 4.19.66
|
||||
(4340d175b898) and 4.14.138 (feb6b123b7dd). */
|
||||
r = cg_unified_controller(controller);
|
||||
if (r < 0)
|
||||
if (r <= 0)
|
||||
return r;
|
||||
if (r == 0) /* doesn't apply to legacy hierarchy */
|
||||
return 0;
|
||||
|
||||
return cg_kill_items(controller, path, sig, flags, s, log_kill, userdata, "cgroup.threads");
|
||||
}
|
||||
|
|
|
@ -837,9 +837,7 @@ static int parse_cmdline_bridge(Context *context, const char *key, const char *v
|
|||
_cleanup_free_ char *word = NULL;
|
||||
|
||||
r = extract_first_word(&p, &word, ",", 0);
|
||||
if (r == 0)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
r = network_set_bridge(context, word, name);
|
||||
|
|
|
@ -1915,10 +1915,8 @@ static int link_append_to_master(Link *link, NetDev *netdev) {
|
|||
return r;
|
||||
|
||||
r = set_put(master->slaves, link);
|
||||
if (r < 0)
|
||||
if (r <= 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return 0;
|
||||
|
||||
link_ref(link);
|
||||
return 0;
|
||||
|
|
|
@ -703,8 +703,9 @@ static int parse_mount_bind_options(const char *options, unsigned long *mount_fl
|
|||
else if (streq(word, "norbind"))
|
||||
flags &= ~MS_REC;
|
||||
else {
|
||||
log_error("Invalid bind mount option: %s", word);
|
||||
return -EINVAL;
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Invalid bind mount option: %s",
|
||||
word);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static int get_mount_flags(const char *path, unsigned long *flags, struct libmnt
|
|||
int r = 0;
|
||||
|
||||
fs = mnt_table_find_target(table, path, MNT_ITER_FORWARD);
|
||||
if (fs == NULL) {
|
||||
if (!fs) {
|
||||
log_warning("Could not find '%s' in mount table", path);
|
||||
goto fallback;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ static void test_exit_status_to_string(void) {
|
|||
class = exit_status_class(i);
|
||||
log_info("%d: %s%s%s%s",
|
||||
i, s ?: "-",
|
||||
class ? " (" : "", class ?: "", class ? ")" : "");
|
||||
class ? " (" : "", strempty(class), class ? ")" : "");
|
||||
|
||||
if (s)
|
||||
assert_se(exit_status_from_string(s) == i);
|
||||
|
|
Loading…
Reference in New Issue