From abda1e9883555734f41c7a12e464b13a72c37a6d Mon Sep 17 00:00:00 2001 From: verdant Date: Mon, 27 Jul 2026 20:37:07 +0800 Subject: Move two util functions to the bottom --- fm.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/fm.c b/fm.c index c7a6ff1..afd390b 100644 --- a/fm.c +++ b/fm.c @@ -19,23 +19,6 @@ static magic_t g_magic_ctx = NULL; -void magic_init(void) -{ - if (!g_magic_ctx) { - g_magic_ctx = magic_open(MAGIC_MIME_TYPE | MAGIC_SYMLINK); - if (!g_magic_ctx) - die("Cannot initialize magic"); - if (magic_load(g_magic_ctx, NULL) != 0) - die("Magic load failed: %s", magic_error(g_magic_ctx)); - } -} - -void magic_cleanup(void) -{ - if (g_magic_ctx) - magic_close(g_magic_ctx); -} - /* Function forward declarations */ static fm_info *fm_w_init(terminal *term); static void fm_file_list_init(file_list *l, int cap); @@ -334,3 +317,20 @@ void fm_cd_down(fm_info *info) free(next_dir); } + +void magic_init(void) +{ + if (!g_magic_ctx) { + g_magic_ctx = magic_open(MAGIC_MIME_TYPE | MAGIC_SYMLINK); + if (!g_magic_ctx) + die("Cannot initialize magic"); + if (magic_load(g_magic_ctx, NULL) != 0) + die("Magic load failed: %s", magic_error(g_magic_ctx)); + } +} + +void magic_cleanup(void) +{ + if (g_magic_ctx) + magic_close(g_magic_ctx); +} -- cgit v1.2.3