From 1e0ab55558bb51416281654f1ed26118053f7717 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 19 Mar 2017 10:53:49 +0100 Subject: [PATCH] main: move "#ifdef ENABLE_LIRC" to lirc.h" --- src/lirc.h | 14 ++++++++++++++ src/main.c | 9 +-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/lirc.h b/src/lirc.h index fa5f3b1..551879b 100644 --- a/src/lirc.h +++ b/src/lirc.h @@ -20,10 +20,24 @@ #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 diff --git a/src/main.c b/src/main.c index 27a3a60..6de16e5 100644 --- a/src/main.c +++ b/src/main.c @@ -31,6 +31,7 @@ #include "strfsong.h" #include "i18n.h" #include "player_command.h" +#include "lirc.h" #ifndef NCMPC_MINI #include "conf.h" @@ -40,10 +41,6 @@ #include "lyrics.h" #endif -#ifdef ENABLE_LIRC -#include "lirc.h" -#endif - #include #include @@ -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 -- 2.30.2