From 3e495b4001889596ac6b148cffd1735343a1333e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed, 25 Jan 2017 13:49:01 +0000 Subject: [PATCH] compat/* should not include tmux.h. --- compat.h | 18 ++++++++++++------ compat/asprintf.c | 2 -- compat/cfmakeraw.c | 2 +- compat/closefrom.c | 2 +- compat/daemon.c | 2 +- compat/fgetln.c | 2 +- compat/forkpty-aix.c | 2 +- compat/forkpty-hpux.c | 2 +- compat/forkpty-sunos.c | 2 +- compat/fparseln.c | 2 +- compat/getopt.c | 2 +- compat/getprogname.c | 2 +- compat/imsg-buffer.c | 2 +- compat/imsg.c | 2 +- compat/imsg.h | 2 -- compat/reallocarray.c | 2 +- compat/setenv.c | 2 +- compat/setproctitle.c | 3 ++- compat/strlcat.c | 2 +- compat/strlcpy.c | 2 +- compat/strtonum.c | 2 +- compat/unvis.c | 2 +- compat/utf8proc.c | 2 +- compat/vis.c | 2 +- 24 files changed, 34 insertions(+), 31 deletions(-) diff --git a/compat.h b/compat.h index 94c0c71e..42479d18 100644 --- a/compat.h +++ b/compat.h @@ -17,6 +17,12 @@ #ifndef COMPAT_H #define COMPAT_H +#include <sys/types.h> +#include <sys/uio.h> + +#include <limits.h> +#include <stdio.h> + #ifndef __GNUC__ #define __attribute__(a) #endif @@ -62,6 +68,12 @@ typedef uint64_t u_int64_t; #define pledge(s, p) (0) #endif +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else +#include <inttypes.h> +#endif + #ifdef HAVE_QUEUE_H #include <sys/queue.h> #else @@ -108,12 +120,6 @@ typedef uint64_t u_int64_t; #include "compat/imsg.h" #endif -#ifdef HAVE_STDINT_H -#include <stdint.h> -#else -#include <inttypes.h> -#endif - #ifdef BROKEN_CMSG_FIRSTHDR #undef CMSG_FIRSTHDR #define CMSG_FIRSTHDR(mhdr) \ diff --git a/compat/asprintf.c b/compat/asprintf.c index 5ed1c48c..2b53dbe2 100644 --- a/compat/asprintf.c +++ b/compat/asprintf.c @@ -23,8 +23,6 @@ #endif #include <string.h> -#include "tmux.h" - int asprintf(char **ret, const char *fmt, ...) { diff --git a/compat/cfmakeraw.c b/compat/cfmakeraw.c index d8794081..df78ba3f 100644 --- a/compat/cfmakeraw.c +++ b/compat/cfmakeraw.c @@ -17,7 +17,7 @@ #include <string.h> -#include "tmux.h" +#include "compat.h" void cfmakeraw(struct termios *tio) diff --git a/compat/closefrom.c b/compat/closefrom.c index 8c650aa5..7915cde4 100644 --- a/compat/closefrom.c +++ b/compat/closefrom.c @@ -45,7 +45,7 @@ # endif #endif -#include "tmux.h" +#include "compat.h" #ifndef OPEN_MAX # define OPEN_MAX 256 diff --git a/compat/daemon.c b/compat/daemon.c index 3e87874b..678d78ef 100644 --- a/compat/daemon.c +++ b/compat/daemon.c @@ -32,7 +32,7 @@ #include <unistd.h> #include <stdlib.h> -#include "tmux.h" +#include "compat.h" int daemon(int nochdir, int noclose) diff --git a/compat/fgetln.c b/compat/fgetln.c index 0ad6378a..c71918cb 100644 --- a/compat/fgetln.c +++ b/compat/fgetln.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include <errno.h> -#include "tmux.h" +#include "compat.h" char * fgetln(FILE *fp, size_t *len) diff --git a/compat/forkpty-aix.c b/compat/forkpty-aix.c index 2557ebf7..193be5ee 100644 --- a/compat/forkpty-aix.c +++ b/compat/forkpty-aix.c @@ -23,7 +23,7 @@ #include <unistd.h> #include <errno.h> -#include "tmux.h" +#include "compat.h" pid_t forkpty(int *master, unused char *name, struct termios *tio, struct winsize *ws) diff --git a/compat/forkpty-hpux.c b/compat/forkpty-hpux.c index 09b27d08..dd71bd6c 100644 --- a/compat/forkpty-hpux.c +++ b/compat/forkpty-hpux.c @@ -22,7 +22,7 @@ #include <stropts.h> #include <unistd.h> -#include "tmux.h" +#include "compat.h" pid_t forkpty(int *master, char *name, struct termios *tio, struct winsize *ws) diff --git a/compat/forkpty-sunos.c b/compat/forkpty-sunos.c index 9abda46c..0de36bf5 100644 --- a/compat/forkpty-sunos.c +++ b/compat/forkpty-sunos.c @@ -23,7 +23,7 @@ #include <stropts.h> #include <unistd.h> -#include "tmux.h" +#include "compat.h" pid_t forkpty(int *master, char *name, struct termios *tio, struct winsize *ws) diff --git a/compat/fparseln.c b/compat/fparseln.c index 348bfa14..5c06f491 100644 --- a/compat/fparseln.c +++ b/compat/fparseln.c @@ -38,7 +38,7 @@ #include <string.h> #include <stdlib.h> -#include "tmux.h" +#include "compat.h" /* * fparseln() specific operation flags. diff --git a/compat/getopt.c b/compat/getopt.c index 97f6c7b1..26e0e6d9 100644 --- a/compat/getopt.c +++ b/compat/getopt.c @@ -29,7 +29,7 @@ /* OPENBSD ORIGINAL: lib/libc/stdlib/getopt.c */ -#include "tmux.h" +#include "compat.h" #include <stdio.h> #include <stdlib.h> diff --git a/compat/getprogname.c b/compat/getprogname.c index 20324ebb..80a496da 100644 --- a/compat/getprogname.c +++ b/compat/getprogname.c @@ -16,7 +16,7 @@ #include <sys/types.h> -#include "tmux.h" +#include "compat.h" #if defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME) const char * diff --git a/compat/imsg-buffer.c b/compat/imsg-buffer.c index 241c4f4d..4c8d5e2c 100644 --- a/compat/imsg-buffer.c +++ b/compat/imsg-buffer.c @@ -26,7 +26,7 @@ #include <string.h> #include <unistd.h> -#include "tmux.h" +#include "compat.h" #include "imsg.h" int ibuf_realloc(struct ibuf *, size_t); diff --git a/compat/imsg.c b/compat/imsg.c index 6c9bee68..422f37ab 100644 --- a/compat/imsg.c +++ b/compat/imsg.c @@ -25,7 +25,7 @@ #include <string.h> #include <unistd.h> -#include "tmux.h" +#include "compat.h" #include "imsg.h" int imsg_fd_overhead = 0; diff --git a/compat/imsg.h b/compat/imsg.h index 06fe1bc1..89946578 100644 --- a/compat/imsg.h +++ b/compat/imsg.h @@ -18,8 +18,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "tmux.h" - #ifndef _IMSG_H_ #define _IMSG_H_ diff --git a/compat/reallocarray.c b/compat/reallocarray.c index f4705fcd..ba17e3f4 100644 --- a/compat/reallocarray.c +++ b/compat/reallocarray.c @@ -20,7 +20,7 @@ #include <stdint.h> #include <stdlib.h> -#include "tmux.h" +#include "compat.h" /* * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX diff --git a/compat/setenv.c b/compat/setenv.c index b16b08cf..9f9295c8 100644 --- a/compat/setenv.c +++ b/compat/setenv.c @@ -18,7 +18,7 @@ #include <stdlib.h> #include <string.h> -#include "tmux.h" +#include "compat.h" int setenv(const char *name, const char *value, unused int overwrite) diff --git a/compat/setproctitle.c b/compat/setproctitle.c index bda924ef..990f4ded 100644 --- a/compat/setproctitle.c +++ b/compat/setproctitle.c @@ -16,9 +16,10 @@ #include <sys/types.h> +#include <stdarg.h> #include <string.h> -#include "tmux.h" +#include "compat.h" #if defined(HAVE_PRCTL) && defined(HAVE_PR_SET_NAME) diff --git a/compat/strlcat.c b/compat/strlcat.c index e081c4f6..836e3929 100644 --- a/compat/strlcat.c +++ b/compat/strlcat.c @@ -19,7 +19,7 @@ #include <sys/types.h> #include <string.h> -#include "tmux.h" +#include "compat.h" /* * Appends src to string dst of size siz (unlike strncat, siz is the diff --git a/compat/strlcpy.c b/compat/strlcpy.c index d6e8e77c..46a22240 100644 --- a/compat/strlcpy.c +++ b/compat/strlcpy.c @@ -19,7 +19,7 @@ #include <sys/types.h> #include <string.h> -#include "tmux.h" +#include "compat.h" /* * Copy src to string dst of size siz. At most siz-1 characters diff --git a/compat/strtonum.c b/compat/strtonum.c index 4c7b0c9f..25a58615 100644 --- a/compat/strtonum.c +++ b/compat/strtonum.c @@ -21,7 +21,7 @@ #include <limits.h> #include <stdlib.h> -#include "tmux.h" +#include "compat.h" #define INVALID 1 #define TOOSMALL 2 diff --git a/compat/unvis.c b/compat/unvis.c index e1f09ec9..6108e772 100644 --- a/compat/unvis.c +++ b/compat/unvis.c @@ -31,7 +31,7 @@ #include <sys/types.h> #include <ctype.h> -#include "tmux.h" +#include "compat.h" /* * decode driven by state machine diff --git a/compat/utf8proc.c b/compat/utf8proc.c index f7f5c987..dd4ab27f 100644 --- a/compat/utf8proc.c +++ b/compat/utf8proc.c @@ -18,7 +18,7 @@ #include <utf8proc.h> -#include "tmux.h" +#include "compat.h" int utf8proc_wcwidth(wchar_t wc) diff --git a/compat/vis.c b/compat/vis.c index 82b42be9..3d37805b 100644 --- a/compat/vis.c +++ b/compat/vis.c @@ -35,7 +35,7 @@ #include <string.h> #include <stdlib.h> -#include "tmux.h" +#include "compat.h" #define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') #define isvisible(c,flag) \