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
pull/335/head
NRK 2 years ago committed by Gitea
parent 86a83c1ec5
commit 6d5a04005d

@ -20,6 +20,7 @@
#include "nsxiv.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>

@ -26,7 +26,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#if HAVE_LIBEXIF

@ -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;

@ -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,

@ -21,6 +21,7 @@
#include "version.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

@ -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>

@ -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>

Loading…
Cancel
Save