tree-wide: some more [static] related fixes

let's add [static] where it was missing so far

Drop [static] on parameters that can be NULL.

Add an assert() around parameters that have [static] and can't be NULL
hence.

Add some "const" where it was forgotten.
This commit is contained in:
Lennart Poettering
2019-07-12 16:40:10 +02:00
parent 6fb0569065
commit 2caa38e99f
10 changed files with 30 additions and 12 deletions
+2
View File
@@ -660,6 +660,8 @@ int efi_set_boot_order(uint16_t *order, size_t n) {
static int boot_id_hex(const char s[static 4]) {
int id = 0, i;
assert(s);
for (i = 0; i < 4; i++)
if (s[i] >= '0' && s[i] <= '9')
id |= (s[i] - '0') << (3 - i) * 4;
+2
View File
@@ -652,6 +652,8 @@ int ethtool_set_glinksettings(
struct ifreq ifr = {};
int r;
assert(advertise);
if (autonegotiation != AUTONEG_DISABLE && memeqzero(advertise, sizeof(uint32_t) * N_ADVERTISE)) {
log_info("ethtool: autonegotiation is unset or enabled, the speed and duplex are not writable.");
return 0;