[systemd-devel] [PATCH] config_parse_exec_mount_flags: get rid of unnecessary copy
Maciej Wereski
m.wereski at partner.samsung.com
Fri Feb 6 07:46:29 PST 2015
---
src/core/load-fragment.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 90bf563..6108d12 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1203,21 +1203,15 @@ int config_parse_exec_mount_flags(const char *unit,
assert(data);
FOREACH_WORD_SEPARATOR(word, l, rvalue, ", ", state) {
- _cleanup_free_ char *t;
-
- t = strndup(word, l);
- if (!t)
- return log_oom();
-
- if (streq(t, "shared"))
+ if (strneq(word, "shared", l))
flags = MS_SHARED;
- else if (streq(t, "slave"))
+ else if (strneq(word, "slave", l))
flags = MS_SLAVE;
- else if (streq(word, "private"))
+ else if (strneq(word, "private", l))
flags = MS_PRIVATE;
else {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Failed to parse mount flag %s, ignoring: %s", t, rvalue);
+ "Failed to parse mount flag %.*s, ignoring: %s", l, word, rvalue);
return 0;
}
}
--
2.3.0
More information about the systemd-devel
mailing list