summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2022-01-12 09:53:15 +0100
committerChristian Hesse <mail@eworm.de>2022-02-08 10:54:40 +0100
commitfacb67f8438aa8ef18ffacdccfd0a2d1c2730e5c (patch)
tree1a3588038565354151a92a616f3c3f3311fab62f /src/main.c
parent4affafe91579799efd83f4c8e05c291eeb684c9c (diff)
global initialization for libmagic
Add a global `magic_t magic` and initialize it just once. Also `feh_is_image()` now calls itself to check compressed files, saving some duplicate code.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 3d124fd..34b667a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -69,6 +69,10 @@ int main(int argc, char **argv)
#endif
}
+#ifdef HAVE_LIBMAGIC
+ init_magic();
+#endif
+
feh_event_init();
if (opt.index)
@@ -262,6 +266,10 @@ void feh_clean_exit(void)
if(disp)
XCloseDisplay(disp);
+#ifdef HAVE_LIBMAGIC
+ uninit_magic();
+#endif
+
/*
* Only restore the old terminal settings if
* - we changed them in the first place