diff options
| author | Tristan Riehs <tristan.riehs@inria.fr> | 2025-11-11 18:51:01 +0100 |
|---|---|---|
| committer | Tristan Riehs <tristan.riehs@inria.fr> | 2025-11-11 18:51:01 +0100 |
| commit | c4f78f15db36b7d4034e2f20eebeb36f48293380 (patch) | |
| tree | 6770cea1cc13d93dcea631749ef8b7f2bb10574d | |
| parent | 17aa6cec8cf2df8248106584d057ef7d00e2b608 (diff) | |
Define toplevel commands locally
They need not be global. Also remove function declarations this change
made useless.
| -rw-r--r-- | src/main.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -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; } |
