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
+3
View File
@@ -400,6 +400,9 @@ static int append_vendor_model(
const struct scsi_id_device *dev_scsi,
char buf[static VENDOR_LENGTH + MODEL_LENGTH]) {
assert(dev_scsi);
assert(buf);
if (strnlen(dev_scsi->vendor, VENDOR_LENGTH) != VENDOR_LENGTH)
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
"%s: bad vendor string \"%s\"",
+1
View File
@@ -156,6 +156,7 @@ static int get_subst_type(const char **str, bool strict, FormatSubstitutionType
assert(str);
assert(*str);
assert(ret_type);
assert(ret_attr);
if (*p == '$') {
p++;
+2
View File
@@ -1464,6 +1464,8 @@ static int attr_subst_subdir(char attr[static UTIL_PATH_SIZE]) {
const char *tail;
size_t len, size;
assert(attr);
tail = strstr(attr, "/*/");
if (!tail)
return 0;