From c4f78f15db36b7d4034e2f20eebeb36f48293380 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Tue, 11 Nov 2025 18:51:01 +0100 Subject: Define toplevel commands locally They need not be global. Also remove function declarations this change made useless. --- src/main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index b8953fb..1fc94be 100644 --- a/src/main.c +++ b/src/main.c @@ -14,10 +14,6 @@ struct ftag_command { void (*func)(int argc, char **argv); }; -static void ftag_init(int, char **); -static void ftag_help(int, char **); -static void ftag_tag(int, char **); - /* Parse arguments using an array of available commands. ARGV[0] has to match * the "name" field of an entry of COMMANDS. */ static void parse_args(int argc, @@ -25,13 +21,6 @@ static void parse_args(int argc, const struct ftag_command *commands, int command_count); -static const struct ftag_command toplevel_commands[] = { - {.name = "init", .func = ftag_init}, - {.name = "help", .func = ftag_help}, - {.name = "tag", .func = ftag_tag} -}; -static const int toplevel_command_count = sizeof(toplevel_commands) / sizeof(struct ftag_command); - static void __sqlite3_check(int rc, sqlite3 *db, const char *file, int line, const char *func) { if (rc == SQLITE_OK) @@ -209,6 +198,12 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + const struct ftag_command toplevel_commands[] = { + {.name = "init", .func = ftag_init}, + {.name = "help", .func = ftag_help}, + {.name = "tag", .func = ftag_tag} + }; + const int toplevel_command_count = sizeof(toplevel_commands) / sizeof(struct ftag_command); parse_args(argc-1, argv+1, toplevel_commands, toplevel_command_count); return EXIT_SUCCESS; } -- cgit v1.2.3