aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorexplosion-mental <explosion0mental@gmail.com>2022-04-26 20:43:27 -0500
committerGitHub <noreply@github.com>2022-04-27 01:43:27 +0000
commitf9662efb1f522c1b554f789659d261a97a1918f5 (patch)
tree80107d052d8aeb68c9f4c3a874ce889f6040e562
parent29c6b1456e8bb46fbee0e8ea962553cb9f1230a3 (diff)
merge autoreload_{inotify,nop}.c into autoreload.c (#263)
-rw-r--r--Makefile6
-rw-r--r--autoreload.c (renamed from autoreload_inotify.c)28
-rw-r--r--autoreload_nop.c41
3 files changed, 30 insertions, 45 deletions
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
index 87ce369..d51e008 100644
--- a/autoreload_inotify.c
+++ b/autoreload.c
@@ -18,6 +18,8 @@
#include "nsxiv.h"
+#if HAVE_INOTIFY
+
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -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 <http://www.gnu.org/licenses/>.
- */
-
-#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;
-}