Code

main: move "#ifdef ENABLE_LIRC" to lirc.h"
authorMax Kellermann <max.kellermann@gmail.com>
Sun, 19 Mar 2017 09:53:49 +0000 (10:53 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Sun, 19 Mar 2017 09:53:49 +0000 (10:53 +0100)
src/lirc.h
src/main.c

index fa5f3b17958797e577712516510c6aa43f769cfc..551879b344bd65c0756520a8ec41fbee80b45de7 100644 (file)
 #ifndef LIRC_H
 #define LIRC_H
 
+#include "config.h"
+
+#ifdef ENABLE_LIRC
+
 void
 ncmpc_lirc_init(void);
 
 void
 ncmpc_lirc_deinit(void);
 
+#else
+
+static inline void
+ncmpc_lirc_init(void) {}
+
+static inline void
+ncmpc_lirc_deinit(void) {}
+
+#endif
+
 #endif
index 27a3a603b0f29871a5644cfc98c26dd290045a96..6de16e54bed8078f7b6f37b17ecc230dfd922cd3 100644 (file)
@@ -31,6 +31,7 @@
 #include "strfsong.h"
 #include "i18n.h"
 #include "player_command.h"
+#include "lirc.h"
 
 #ifndef NCMPC_MINI
 #include "conf.h"
 #include "lyrics.h"
 #endif
 
-#ifdef ENABLE_LIRC
-#include "lirc.h"
-#endif
-
 #include <mpd/client.h>
 
 #include <stdlib.h>
@@ -553,10 +550,8 @@ main(int argc, const char *argv[])
        g_io_add_watch(keyboard_channel, G_IO_IN, keyboard_event, NULL);
        g_io_channel_unref(keyboard_channel);
 
-#ifdef ENABLE_LIRC
        /* watch out for lirc input */
        ncmpc_lirc_init();
-#endif
 
 #ifndef WIN32
        if (!pipe(sigwinch_pipes) &&
@@ -602,9 +597,7 @@ main(int argc, const char *argv[])
        close(sigwinch_pipes[0]);
        close(sigwinch_pipes[1]);
 
-#ifdef ENABLE_LIRC
        ncmpc_lirc_deinit();
-#endif
 
        screen_exit();
 #ifndef NCMPC_MINI