]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Use VLA instead of alloca
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 Dec 2018 15:38:03 +0000 (16:38 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 10 Dec 2018 10:57:26 +0000 (11:57 +0100)
The test is the same, but an array is more readable.

src/core/unit.c

index e1b6e9f11cc67a8f0ecc84672d575a811709caae..a9303a0f3f28335c6c491711884dad05494df17a 100644 (file)
@@ -4580,7 +4580,6 @@ int unit_kill_context(
 
 int unit_require_mounts_for(Unit *u, const char *path, UnitDependencyMask mask) {
         _cleanup_free_ char *p = NULL;
-        char *prefix;
         UnitDependencyInfo di;
         int r;
 
@@ -4620,7 +4619,7 @@ int unit_require_mounts_for(Unit *u, const char *path, UnitDependencyMask mask)
                 return r;
         p = NULL;
 
-        prefix = alloca(strlen(path) + 1);
+        char prefix[strlen(path) + 1];
         PATH_FOREACH_PREFIX_MORE(prefix, path) {
                 Set *x;