]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bus-unit-util: move explanations array to inner scope
authorLennart Poettering <lennart@poettering.net>
Wed, 6 Mar 2019 18:16:25 +0000 (19:16 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Mar 2019 16:38:43 +0000 (17:38 +0100)
It's specific to service units, hence let's minimize the scope since it
has no validity outside of the log message generation for service units.

src/shared/bus-unit-util.c

index 1ed895bd3742217972acaf8a3de71bb1753d1677..6410b389e52d308e4380c2f308e0f8d71ab6b6f4 100644 (file)
@@ -1921,23 +1921,23 @@ static int bus_job_get_service_result(BusWaitForJobs *d, char **result) {
                                           result);
 }
 
-static const struct {
-        const char *result, *explanation;
-} explanations [] = {
-        { "resources",   "of unavailable resources or another system error" },
-        { "protocol",    "the service did not take the steps required by its unit configuration" },
-        { "timeout",     "a timeout was exceeded" },
-        { "exit-code",   "the control process exited with error code" },
-        { "signal",      "a fatal signal was delivered to the control process" },
-        { "core-dump",   "a fatal signal was delivered causing the control process to dump core" },
-        { "watchdog",    "the service failed to send watchdog ping" },
-        { "start-limit", "start of the service was attempted too often" }
-};
-
 static void log_job_error_with_service_result(const char* service, const char *result, const char* const* extra_args) {
         _cleanup_free_ char *service_shell_quoted = NULL;
         const char *systemctl = "systemctl", *journalctl = "journalctl";
 
+        static const struct {
+                const char *result, *explanation;
+        } explanations[] = {
+                { "resources",   "of unavailable resources or another system error" },
+                { "protocol",    "the service did not take the steps required by its unit configuration" },
+                { "timeout",     "a timeout was exceeded" },
+                { "exit-code",   "the control process exited with error code" },
+                { "signal",      "a fatal signal was delivered to the control process" },
+                { "core-dump",   "a fatal signal was delivered causing the control process to dump core" },
+                { "watchdog",    "the service failed to send watchdog ping" },
+                { "start-limit", "start of the service was attempted too often" }
+        };
+
         assert(service);
 
         service_shell_quoted = shell_maybe_quote(service, ESCAPE_BACKSLASH);
@@ -1951,7 +1951,7 @@ static void log_job_error_with_service_result(const char* service, const char *r
         }
 
         if (!isempty(result)) {
-                unsigned i;
+                size_t i;
 
                 for (i = 0; i < ELEMENTSOF(explanations); ++i)
                         if (streq(result, explanations[i].result))