Krolyxon
Commit 6d5a040

Branches

Refs →

nsxiv6d5a040

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
Author
NRK
Date
2022-05-31 17:25 +0600
Committer
Gitea · 2022-06-28 21:28 +0200
Parent
86a83c1
Commit
6d5a04005dd1dff12ebfe2e3a56912ec26718f3f

+16 −16

7 files changed

  1. M commands.c +1 −0
  2. M image.c +0 −1
  3. M main.c +10 −0
  4. M nsxiv.h +1 −13
  5. M options.c +1 −0
  6. M thumbs.c +1 −1
  7. M util.c +2 −1
M commands.c View
@@ -20,6 +20,7 @@
2020 #include "nsxiv.h"
2121
2222 #include <stdlib.h>
23+#include <stdio.h>
2324 #include <string.h>
2425 #include <unistd.h>
2526 #include <sys/wait.h>
M image.c View
@@ -26,7 +26,6 @@
2626 #include <stdlib.h>
2727 #include <string.h>
2828 #include <sys/stat.h>
29−#include <sys/types.h>
3029 #include <unistd.h>
3130
3231 #if HAVE_LIBEXIF
M main.c View
@@ -23,6 +23,8 @@
2323 #include "config.h"
2424
2525 #include <stdlib.h>
26+#include <stdarg.h>
27+#include <stdio.h>
2628 #include <string.h>
2729 #include <fcntl.h>
2830 #include <unistd.h>
@@ -33,12 +35,20 @@
3335 #include <sys/stat.h>
3436 #include <sys/wait.h>
3537 #include <time.h>
38+#include <sys/time.h>
3639 #include <X11/keysym.h>
3740 #include <X11/XF86keysym.h>
3841
3942 #define MODMASK(mask) ((mask) & USED_MODMASK)
4043 #define BAR_SEP " "
4144
45+#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
46+ ((t1)->tv_usec - (t2)->tv_usec) / 1000)
47+#define TV_ADD_MSEC(tv,t) { \
48+ (tv)->tv_sec += (t) / 1000; \
49+ (tv)->tv_usec += (t) % 1000 * 1000; \
50+}
51+
4252 typedef struct {
4353 struct timeval when;
4454 bool active;
M nsxiv.h View
@@ -20,11 +20,8 @@
2020 #ifndef NSXIV_H
2121 #define NSXIV_H
2222
23−#include <stdarg.h>
23+#include <stddef.h>
2424 #include <stdbool.h>
25−#include <stdio.h>
26−#include <sys/time.h>
27−#include <sys/types.h>
2825 #include <Imlib2.h>
2926 #include <X11/Xlib.h>
3027
@@ -39,17 +36,8 @@
3936 #define ABS(a) ((a) > 0 ? (a) : -(a))
4037
4138 #define ARRLEN(a) (sizeof(a) / sizeof((a)[0]))
42−
4339 #define STREQ(s1,s2) (strcmp((s1), (s2)) == 0)
4440
45−#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
46− ((t1)->tv_usec - (t2)->tv_usec) / 1000)
47−
48−#define TV_ADD_MSEC(tv,t) { \
49− (tv)->tv_sec += (t) / 1000; \
50− (tv)->tv_usec += (t) % 1000 * 1000; \
51−}
52−
5341 typedef enum {
5442 MODE_ALL,
5543 MODE_IMAGE,
M options.c View
@@ -21,6 +21,7 @@
2121 #include "version.h"
2222
2323 #include <stdlib.h>
24+#include <stdio.h>
2425 #include <string.h>
2526 #include <unistd.h>
2627
M thumbs.c View
@@ -22,9 +22,9 @@
2222 #include "config.h"
2323
2424 #include <errno.h>
25+#include <stdio.h>
2526 #include <stdlib.h>
2627 #include <string.h>
27−#include <sys/types.h>
2828 #include <sys/stat.h>
2929 #include <unistd.h>
3030 #include <utime.h>
M util.c View
@@ -21,8 +21,9 @@
2121
2222 #include <assert.h>
2323 #include <stdlib.h>
24+#include <stdarg.h>
25+#include <stdio.h>
2426 #include <string.h>
25−#include <sys/types.h>
2627 #include <sys/stat.h>
2728 #include <unistd.h>
2829 #include <errno.h>