From: Zbigniew Jędrzejewski-Szmek Date: Fri, 7 Dec 2018 15:38:03 +0000 (+0100) Subject: Use VLA instead of alloca X-Git-Tag: v240~97^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4cb06c5949eba752f87dd6ad74620cc0e5cabf4a;p=thirdparty%2Fsystemd.git Use VLA instead of alloca The test is the same, but an array is more readable. --- diff --git a/src/core/unit.c b/src/core/unit.c index e1b6e9f11cc..a9303a0f3f2 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -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;