aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-05-31 13:25:14 +0200
committerGitea <gitea@fake.local>2022-06-28 21:28:06 +0200
commit6d5a04005dd1dff12ebfe2e3a56912ec26718f3f (patch)
tree56e39d86053cb3e6c72c7c3a0694b13780f434a6
parent86a83c1ec5ba2a6e5130a373fca394a7002060c7 (diff)
downloadnsxiv-6d5a04005dd1dff12ebfe2e3a56912ec26718f3f.tar.zst
code-style: cleanup includes
* rm unused include <sys/types.h> * move <sys/time.h> to main.c, it's the only file that needs it. * move TV_* macros to main.c * let *.c files explicitly include what they need instead of including them at nsxiv.h
-rw-r--r--commands.c1
-rw-r--r--image.c1
-rw-r--r--main.c10
-rw-r--r--nsxiv.h14
-rw-r--r--options.c1
-rw-r--r--thumbs.c2
-rw-r--r--util.c3
7 files changed, 16 insertions, 16 deletions
diff --git a/commands.c b/commands.c
index 2c4f4a7..8a73462 100644
--- a/commands.c
+++ b/commands.c
@@ -20,6 +20,7 @@
#include "nsxiv.h"
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
diff --git a/image.c b/image.c
index bcefa54..05459cf 100644
--- a/image.c
+++ b/image.c
@@ -26,7 +26,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#if HAVE_LIBEXIF
diff --git a/main.c b/main.c
index 64710f2..10f7440 100644
--- a/main.c
+++ b/main.c
@@ -23,6 +23,8 @@
#include "config.h"
#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
@@ -33,12 +35,20 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <time.h>
+#include <sys/time.h>
#include <X11/keysym.h>
#include <X11/XF86keysym.h>
#define MODMASK(mask) ((mask) & USED_MODMASK)
#define BAR_SEP " "
+#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
+ ((t1)->tv_usec - (t2)->tv_usec) / 1000)
+#define TV_ADD_MSEC(tv,t) { \
+ (tv)->tv_sec += (t) / 1000; \
+ (tv)->tv_usec += (t) % 1000 * 1000; \
+}
+
typedef struct {
struct timeval when;
bool active;
diff --git a/nsxiv.h b/nsxiv.h
index 38e1d7b..eb06328 100644
--- a/nsxiv.h
+++ b/nsxiv.h
@@ -20,11 +20,8 @@
#ifndef NSXIV_H
#define NSXIV_H
-#include <stdarg.h>
+#include <stddef.h>
#include <stdbool.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <sys/types.h>
#include <Imlib2.h>
#include <X11/Xlib.h>
@@ -39,17 +36,8 @@
#define ABS(a) ((a) > 0 ? (a) : -(a))
#define ARRLEN(a) (sizeof(a) / sizeof((a)[0]))
-
#define STREQ(s1,s2) (strcmp((s1), (s2)) == 0)
-#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
- ((t1)->tv_usec - (t2)->tv_usec) / 1000)
-
-#define TV_ADD_MSEC(tv,t) { \
- (tv)->tv_sec += (t) / 1000; \
- (tv)->tv_usec += (t) % 1000 * 1000; \
-}
-
typedef enum {
MODE_ALL,
MODE_IMAGE,
diff --git a/options.c b/options.c
index 8ae5c7e..8fade87 100644
--- a/options.c
+++ b/options.c
@@ -21,6 +21,7 @@
#include "version.h"
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
diff --git a/thumbs.c b/thumbs.c
index b8ba2d1..8341014 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -22,9 +22,9 @@
#include "config.h"
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <utime.h>
diff --git a/util.c b/util.c
index 9c97dda..31ab4b8 100644
--- a/util.c
+++ b/util.c
@@ -21,8 +21,9 @@
#include <assert.h>
#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>