From: Yu Watanabe Date: Tue, 20 Nov 2018 06:13:16 +0000 (+0900) Subject: analyze: use static destructors X-Git-Tag: v240~258^2~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d665c7b2db8afcc1772688e6c9bb68913bdf2a3e;p=thirdparty%2Fsystemd.git analyze: use static destructors --- diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index f82c5023d52..959c078c5c0 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -26,6 +26,7 @@ #include "hashmap.h" #include "locale-util.h" #include "log.h" +#include "main-func.h" #include "pager.h" #include "parse-util.h" #include "path-util.h" @@ -75,6 +76,9 @@ static bool arg_man = true; static bool arg_generators = false; static const char *arg_root = NULL; +STATIC_DESTRUCTOR_REGISTER(arg_dot_from_patterns, strv_freep); +STATIC_DESTRUCTOR_REGISTER(arg_dot_to_patterns, strv_freep); + struct boot_times { usec_t firmware_time; usec_t loader_time; @@ -1989,7 +1993,7 @@ static int parse_argv(int argc, char *argv[]) { return 1; /* work to do */ } -int main(int argc, char *argv[]) { +static int run(int argc, char *argv[]) { static const Verb verbs[] = { { "help", VERB_ANY, VERB_ANY, 0, help }, @@ -2026,15 +2030,9 @@ int main(int argc, char *argv[]) { r = parse_argv(argc, argv); if (r <= 0) - goto finish; - - r = dispatch_verb(argc, argv, verbs, NULL); - -finish: - pager_close(); - - strv_free(arg_dot_from_patterns); - strv_free(arg_dot_to_patterns); + return r; - return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + return dispatch_verb(argc, argv, verbs, NULL); } + +DEFINE_MAIN_FUNCTION(run);