mount: code shrink

function                                             old     new   delta
append_mount_options                                 174     157     -17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2021-08-23 02:31:26 +02:00
parent dbdf9e0ab1
commit 1b661122a8

View File

@ -562,9 +562,9 @@ static void append_mount_options(char **oldopts, const char *newopts)
// Do not insert options which are already there // Do not insert options which are already there
while (newopts[0]) { while (newopts[0]) {
char *p; char *p;
int len = strlen(newopts); int len;
p = strchr(newopts, ',');
if (p) len = p - newopts; len = strchrnul(newopts, ',') - newopts;
p = *oldopts; p = *oldopts;
while (1) { while (1) {
if (!strncmp(p, newopts, len) if (!strncmp(p, newopts, len)
@ -579,7 +579,7 @@ static void append_mount_options(char **oldopts, const char *newopts)
*oldopts = p; *oldopts = p;
skip: skip:
newopts += len; newopts += len;
while (newopts[0] == ',') newopts++; while (*newopts == ',') newopts++;
} }
} else { } else {
if (ENABLE_FEATURE_CLEAN_UP) free(*oldopts); if (ENABLE_FEATURE_CLEAN_UP) free(*oldopts);