From f9662efb1f522c1b554f789659d261a97a1918f5 Mon Sep 17 00:00:00 2001 From: explosion-mental Date: Tue, 26 Apr 2022 20:43:27 -0500 Subject: [PATCH] merge autoreload_{inotify,nop}.c into autoreload.c (#263) --- Makefile | 6 ++-- autoreload_inotify.c => autoreload.c | 28 +++++++++++++++++++ autoreload_nop.c | 41 ---------------------------- 3 files changed, 30 insertions(+), 45 deletions(-) rename autoreload_inotify.c => autoreload.c (90%) delete mode 100644 autoreload_nop.c diff --git a/Makefile b/Makefile index e33f0c9..5c08ed0 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ inc_fonts_1 = -I/usr/include/freetype2 -I$(PREFIX)/include/freetype2 CPPFLAGS = -D_XOPEN_SOURCE=700 \ -DHAVE_LIBGIF=$(HAVE_LIBGIF) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) \ -DHAVE_LIBWEBP=$(HAVE_LIBWEBP) -DHAVE_LIBFONTS=$(HAVE_LIBFONTS) \ - $(inc_fonts_$(HAVE_LIBFONTS)) + -DHAVE_INOTIFY=$(HAVE_INOTIFY) $(inc_fonts_$(HAVE_LIBFONTS)) lib_fonts_0 = lib_fonts_1 = -lXft -lfontconfig @@ -42,14 +42,12 @@ lib_gif_0 = lib_gif_1 = -lgif lib_webp_0 = lib_webp_1 = -lwebpdemux -lwebp -autoreload_0 = nop -autoreload_1 = inotify NSXIV_LDLIBS = -lImlib2 -lX11 \ $(lib_exif_$(HAVE_LIBEXIF)) $(lib_gif_$(HAVE_LIBGIF)) \ $(lib_webp_$(HAVE_LIBWEBP)) $(lib_fonts_$(HAVE_LIBFONTS)) -OBJS = autoreload_$(autoreload_$(HAVE_INOTIFY)).o commands.o image.o main.o options.o \ +OBJS = autoreload.o commands.o image.o main.o options.o \ thumbs.o util.o window.o .SUFFIXES: diff --git a/autoreload_inotify.c b/autoreload.c similarity index 90% rename from autoreload_inotify.c rename to autoreload.c index 87ce369..d51e008 100644 --- a/autoreload_inotify.c +++ b/autoreload.c @@ -18,6 +18,8 @@ #include "nsxiv.h" +#if HAVE_INOTIFY + #include #include #include @@ -109,3 +111,29 @@ bool arl_handle(arl_t *arl) } return reload; } + +#else + +void arl_init(arl_t *arl) +{ + arl->fd = -1; +} + +void arl_cleanup(arl_t *arl) +{ + (void) arl; +} + +void arl_setup(arl_t *arl, const char *filepath) +{ + (void) arl; + (void) filepath; +} + +bool arl_handle(arl_t *arl) +{ + (void) arl; + return false; +} + +#endif /* HAVE_INOTIFY */ diff --git a/autoreload_nop.c b/autoreload_nop.c deleted file mode 100644 index 4d17f54..0000000 --- a/autoreload_nop.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2017 Max Voit - * - * This file is a part of nsxiv. - * - * nsxiv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * nsxiv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with nsxiv. If not, see . - */ - -#include "nsxiv.h" - -void arl_init(arl_t *arl) -{ - arl->fd = -1; -} - -void arl_cleanup(arl_t *arl) -{ - (void) arl; -} - -void arl_setup(arl_t *arl, const char *filepath) -{ - (void) arl; - (void) filepath; -} - -bool arl_handle(arl_t *arl) -{ - (void) arl; - return false; -}