aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--array.c4
-rw-r--r--array.h3
-rw-r--r--buffer.c5
-rw-r--r--buffer.h2
-rwxr-xr-xconfigure2
-rw-r--r--event-basic.c2
-rw-r--r--map.c3
-rw-r--r--sam.c9
-rw-r--r--test/core/array-test.c7
-rw-r--r--test/core/buffer-test.c8
-rw-r--r--test/core/map-test.c7
-rw-r--r--test/core/text-test.c11
-rw-r--r--text-common.c3
-rw-r--r--text-internal.h2
-rw-r--r--text-io.c16
-rw-r--r--text-iterator.c5
-rw-r--r--text-motions.c6
-rw-r--r--text-motions.h1
-rw-r--r--text-objects.c4
-rw-r--r--text-objects.h1
-rw-r--r--text-regex-tre.c5
-rw-r--r--text-regex.c3
-rw-r--r--text-util.c3
-rw-r--r--text-util.h2
-rw-r--r--text.c15
-rw-r--r--text.h8
-rw-r--r--ui-terminal-curses.c1
-rw-r--r--ui-terminal.c17
-rw-r--r--ui.h4
-rw-r--r--util.h36
-rw-r--r--view.c8
-rw-r--r--view.h3
-rw-r--r--vis-cmds.c1
-rw-r--r--vis-core.h2
-rw-r--r--vis-lua.c10
-rw-r--r--vis-menu.c3
-rw-r--r--vis-modes.c2
-rw-r--r--vis-motions.c3
-rw-r--r--vis-operators.c2
-rw-r--r--vis-prompt.c1
-rw-r--r--vis-registers.c3
-rw-r--r--vis-subprocess.c7
-rw-r--r--vis-subprocess.h1
-rw-r--r--vis.c25
45 files changed, 52 insertions, 216 deletions
diff --git a/Makefile b/Makefile
index 3335f10..bf1dc69 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ DOCUMENTATION = LICENSE README.md
VERSION = $(shell git describe --always --dirty 2>/dev/null || echo "v0.9-git")
-CFLAGS_STD ?= -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG
+CFLAGS_STD ?= -std=c99 -DNDEBUG
CFLAGS_STD += -DVERSION=\"${VERSION}\"
LDFLAGS_STD ?= -lc
diff --git a/array.c b/array.c
index b1e55b2..a6de4b1 100644
--- a/array.c
+++ b/array.c
@@ -1,7 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
#include "util.h"
#include "array.h"
diff --git a/array.h b/array.h
index 1d9e1cf..9deac45 100644
--- a/array.h
+++ b/array.h
@@ -1,9 +1,6 @@
#ifndef ARRAY_H
#define ARRAY_H
-#include <stddef.h>
-#include <stdbool.h>
-
/**
* @file
*
diff --git a/buffer.c b/buffer.c
index 709a328..67070b9 100644
--- a/buffer.c
+++ b/buffer.c
@@ -1,8 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-
#include "buffer.h"
#ifndef BUFFER_SIZE
diff --git a/buffer.h b/buffer.h
index 66e8d4d..d8a58fb 100644
--- a/buffer.h
+++ b/buffer.h
@@ -1,8 +1,6 @@
#ifndef BUFFER_H
#define BUFFER_H
-#include <stddef.h>
-#include <stdbool.h>
#include "text.h"
/**
diff --git a/configure b/configure
index 7278f99..1842e23 100755
--- a/configure
+++ b/configure
@@ -220,7 +220,7 @@ tryflag CFLAGS_TRY -Werror=unused-command-line-argument
tryldflag LDFLAGS_TRY -Werror=unknown-warning-option
tryldflag LDFLAGS_TRY -Werror=unused-command-line-argument
-CFLAGS_STD="-std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG"
+CFLAGS_STD="-std=c99 -DNDEBUG"
LDFLAGS_STD="-lc"
OS=$(uname)
diff --git a/event-basic.c b/event-basic.c
index e070522..a03d13f 100644
--- a/event-basic.c
+++ b/event-basic.c
@@ -1,5 +1,3 @@
-#include <stdarg.h>
-
#include "vis-core.h"
#if !CONFIG_LUA
diff --git a/map.c b/map.c
index 44b6ade..12b2f16 100644
--- a/map.c
+++ b/map.c
@@ -9,9 +9,6 @@
* http://github.com/agl/critbit
* http://ccodearchive.net/info/strmap.html
*/
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
#include "map.h"
typedef struct Node Node;
diff --git a/sam.c b/sam.c
index 2d6e634..cd91059 100644
--- a/sam.c
+++ b/sam.c
@@ -16,15 +16,6 @@
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-#include <string.h>
-#include <strings.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <limits.h>
-#include <fcntl.h>
-
#include "util.h"
#include "sam.h"
diff --git a/test/core/array-test.c b/test/core/array-test.c
index e4da4f6..5944904 100644
--- a/test/core/array-test.c
+++ b/test/core/array-test.c
@@ -1,9 +1,4 @@
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
+#include "util.h"
#include "tap.h"
diff --git a/test/core/buffer-test.c b/test/core/buffer-test.c
index 8034ac4..edb7786 100644
--- a/test/core/buffer-test.c
+++ b/test/core/buffer-test.c
@@ -1,9 +1,7 @@
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include "util.h"
+
#include "tap.h"
+
#include "buffer.c"
static bool compare(Buffer *buf, const char *data, size_t len) {
diff --git a/test/core/map-test.c b/test/core/map-test.c
index a8231a3..a78777f 100644
--- a/test/core/map-test.c
+++ b/test/core/map-test.c
@@ -1,8 +1,7 @@
-#include <stddef.h>
-#include <stdbool.h>
-#include <string.h>
-#include <stdio.h>
+#include "util.h"
+
#include "tap.h"
+
#include "map.c"
static bool get(Map *map, const char *key, const void *data) {
diff --git a/test/core/text-test.c b/test/core/text-test.c
index c69038c..4ec5fb6 100644
--- a/test/core/text-test.c
+++ b/test/core/text-test.c
@@ -1,14 +1,7 @@
-#include <errno.h>
-#include <fcntl.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include "tap.h"
-
#include "util.h"
+#include "tap.h"
+
#include "array.c"
#include "buffer.c"
#include "text.c"
diff --git a/text-common.c b/text-common.c
index 87dc13f..d052d51 100644
--- a/text-common.c
+++ b/text-common.c
@@ -1,6 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
#include "text.h"
static bool text_vprintf(Text *txt, size_t pos, const char *format, va_list ap) {
diff --git a/text-internal.h b/text-internal.h
index 3f9052f..13647d6 100644
--- a/text-internal.h
+++ b/text-internal.h
@@ -1,8 +1,6 @@
#ifndef TEXT_INTERNAL
#define TEXT_INTERNAL
-#include <stdbool.h>
-#include <stddef.h>
#include "text.h"
/* Block holding the file content, either readonly mmap(2)-ed from the original
diff --git a/text-io.c b/text-io.c
index bbd1f8d..aca5441 100644
--- a/text-io.c
+++ b/text-io.c
@@ -1,19 +1,3 @@
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <libgen.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <limits.h>
-#include <sys/mman.h>
-#if CONFIG_ACL
-#include <sys/acl.h>
-#endif
-#if CONFIG_SELINUX
-#include <selinux/selinux.h>
-#endif
-
#include "text.h"
#include "text-internal.h"
#include "text-util.h"
diff --git a/text-iterator.c b/text-iterator.c
index e264781..3dbf664 100644
--- a/text-iterator.c
+++ b/text-iterator.c
@@ -1,8 +1,3 @@
-#include <limits.h>
-#include <stddef.h>
-#include <errno.h>
-#include <wchar.h>
-#include <string.h>
#include "text.h"
#include "util.h"
diff --git a/text-motions.c b/text-motions.c
index a17adde..9bd6461 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -1,9 +1,3 @@
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <errno.h>
-#include <limits.h>
#include "text-motions.h"
#include "text-util.h"
#include "util.h"
diff --git a/text-motions.h b/text-motions.h
index 95e554d..218b44b 100644
--- a/text-motions.h
+++ b/text-motions.h
@@ -5,7 +5,6 @@
* perform a certain movement and return the new position. If the movement
* is not possible the original position is returned unchanged. */
-#include <stddef.h>
#include "text.h"
#include "text-regex.h"
diff --git a/text-objects.c b/text-objects.c
index 69ea91c..5e724b8 100644
--- a/text-objects.c
+++ b/text-objects.c
@@ -1,7 +1,3 @@
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
#include "text-motions.h"
#include "text-objects.h"
#include "text-util.h"
diff --git a/text-objects.h b/text-objects.h
index d9ea218..f98c496 100644
--- a/text-objects.h
+++ b/text-objects.h
@@ -6,7 +6,6 @@
* such text-object at the given location, an empty range is returned.
*/
-#include <stddef.h>
#include "text.h"
/* return range covering the entire text */
diff --git a/text-regex-tre.c b/text-regex-tre.c
index eccbafb..a4443f7 100644
--- a/text-regex-tre.c
+++ b/text-regex-tre.c
@@ -1,8 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <errno.h>
-
#include "text-regex.h"
#include "text-motions.h"
diff --git a/text-regex.c b/text-regex.c
index 7c6812e..0cf05ab 100644
--- a/text-regex.c
+++ b/text-regex.c
@@ -1,6 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
-
#include "text-regex.h"
struct Regex {
diff --git a/text-util.c b/text-util.c
index 7e47cce..acd80c2 100644
--- a/text-util.c
+++ b/text-util.c
@@ -1,8 +1,5 @@
#include "text-util.h"
#include "util.h"
-#include <wchar.h>
-#include <errno.h>
-#include <stdlib.h>
Filerange text_range_union(const Filerange *r1, const Filerange *r2) {
if (!text_range_valid(r1))
diff --git a/text-util.h b/text-util.h
index 922bab3..9e906b5 100644
--- a/text-util.h
+++ b/text-util.h
@@ -1,8 +1,6 @@
#ifndef TEXT_UTIL_H
#define TEXT_UTIL_H
-#include <stdbool.h>
-#include <stddef.h>
#include "text.h"
/* test whether the given range is valid (start <= end) */
diff --git a/text.c b/text.c
index f2ecce8..b6ea518 100644
--- a/text.c
+++ b/text.c
@@ -1,18 +1,3 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <wchar.h>
-#include <stdint.h>
-#include <libgen.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
#include "util.h"
#include "array.h"
diff --git a/text.h b/text.h
index 9057a6a..4ff8bdb 100644
--- a/text.h
+++ b/text.h
@@ -1,14 +1,6 @@
#ifndef TEXT_H
#define TEXT_H
-#include <stdbool.h>
-#include <stdint.h>
-#include <time.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
#include "util.h"
/** A mark. */
diff --git a/ui-terminal-curses.c b/ui-terminal-curses.c
index a2aa7ec..1224d5a 100644
--- a/ui-terminal-curses.c
+++ b/ui-terminal-curses.c
@@ -1,5 +1,4 @@
/* This file is included from ui-terminal.c */
-#include <stdio.h>
#include <curses.h>
#define UI_TERMKEY_FLAGS (TERMKEY_FLAG_UTF8|TERMKEY_FLAG_NOTERMIOS)
diff --git a/ui-terminal.c b/ui-terminal.c
index a96bea3..746e24c 100644
--- a/ui-terminal.c
+++ b/ui-terminal.c
@@ -1,20 +1,3 @@
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <strings.h>
-#include <limits.h>
-#include <ctype.h>
-#include <locale.h>
-#include <poll.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <errno.h>
-
#include "vis.h"
#include "vis-core.h"
#include "text.h"
diff --git a/ui.h b/ui.h
index 6ed0587..d971562 100644
--- a/ui.h
+++ b/ui.h
@@ -1,10 +1,6 @@
#ifndef UI_H
#define UI_H
-#include <stdbool.h>
-#include <stdarg.h>
-#include <termkey.h>
-
/* enable large file optimization for files larger than: */
#define UI_LARGE_FILE_SIZE (1 << 25)
/* enable large file optimization for files containing lines longer than: */
diff --git a/util.h b/util.h
index 83dd4ab..6e8adbc 100644
--- a/util.h
+++ b/util.h
@@ -26,9 +26,45 @@
#define CONFIG_ACL 0
#endif
+#undef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 700
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <libgen.h>
+#include <limits.h>
+#include <locale.h>
+#include <poll.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/select.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+#include <wchar.h>
+
+#if CONFIG_ACL
+#include <sys/acl.h>
+#endif
+#if CONFIG_SELINUX
+#include <selinux/selinux.h>
+#endif
#define LENGTH(x) ((int)(sizeof (x) / sizeof *(x)))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
diff --git a/view.c b/view.c
index 1cef27a..14b79b1 100644
--- a/view.c
+++ b/view.c
@@ -1,11 +1,3 @@
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-
#include "vis-core.h"
#include "view.h"
#include "text.h"
diff --git a/view.h b/view.h
index b1370a3..c1fe735 100644
--- a/view.h
+++ b/view.h
@@ -1,9 +1,6 @@
#ifndef VIEW_H
#define VIEW_H
-#include <stddef.h>
-#include <stdbool.h>
-
#include "ui.h"
#include "text.h"
#include "array.h"
diff --git a/vis-cmds.c b/vis-cmds.c
index adb5822..0fef1be 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -1,6 +1,5 @@
/* this file is included from sam.c */
-#include <termkey.h>
#include "vis-lua.h"
// FIXME: avoid this redirection?
diff --git a/vis-core.h b/vis-core.h
index 8091305..6c54640 100644
--- a/vis-core.h
+++ b/vis-core.h
@@ -1,8 +1,6 @@
#ifndef VIS_CORE_H
#define VIS_CORE_H
-#include <setjmp.h>
-
#include "util.h"
#include "vis.h"
diff --git a/vis-lua.c b/vis-lua.c
index 6e74e4f..28211a7 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -11,16 +11,6 @@
* @license ISC
* @release RELEASE
*/
-#include <stddef.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
-#include <unistd.h>
-#include <libgen.h>
-#include <sys/types.h>
-#include <pwd.h>
-
#include "util.h"
#include "vis-lua.h"
diff --git a/vis-menu.c b/vis-menu.c
index 1dd115b..0685d40 100644
--- a/vis-menu.c
+++ b/vis-menu.c
@@ -30,6 +30,9 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+#undef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 700
+
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/vis-modes.c b/vis-modes.c
index 5b8a71d..2d8abbd 100644
--- a/vis-modes.c
+++ b/vis-modes.c
@@ -1,5 +1,3 @@
-#include <string.h>
-#include <strings.h>
#include "vis-core.h"
#include "text-motions.h"
#include "util.h"
diff --git a/vis-motions.c b/vis-motions.c
index d864dd5..0510a59 100644
--- a/vis-motions.c
+++ b/vis-motions.c
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
#include "vis-core.h"
#include "text-motions.h"
#include "text-objects.h"
diff --git a/vis-operators.c b/vis-operators.c
index 123d126..ae2da5a 100644
--- a/vis-operators.c
+++ b/vis-operators.c
@@ -1,5 +1,3 @@
-#include <string.h>
-#include <ctype.h>
#include "vis-core.h"
#include "text-motions.h"
#include "text-objects.h"
diff --git a/vis-prompt.c b/vis-prompt.c
index 089a931..f6f06a7 100644
--- a/vis-prompt.c
+++ b/vis-prompt.c
@@ -1,4 +1,3 @@
-#include <string.h>
#include "vis-core.h"
#include "text-motions.h"
#include "text-objects.h"
diff --git a/vis-registers.c b/vis-registers.c
index e1f2c92..2059d5c 100644
--- a/vis-registers.c
+++ b/vis-registers.c
@@ -1,6 +1,3 @@
-#include <stdlib.h>
-#include <string.h>
-
#include "vis-core.h"
static Buffer *register_buffer(Register *reg, size_t slot) {
diff --git a/vis-subprocess.c b/vis-subprocess.c
index b1d6a26..4c556be 100644
--- a/vis-subprocess.c
+++ b/vis-subprocess.c
@@ -1,10 +1,3 @@
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/wait.h>
-
#include "util.h"
#include "vis-lua.h"
diff --git a/vis-subprocess.h b/vis-subprocess.h
index 05f4dfe..3d69978 100644
--- a/vis-subprocess.h
+++ b/vis-subprocess.h
@@ -2,7 +2,6 @@
#define VIS_SUBPROCESS_H
#include "vis-core.h"
#include "vis-lua.h"
-#include <sys/select.h>
typedef struct Process Process;
#if CONFIG_LUA
diff --git a/vis.c b/vis.c
index fcadd10..5bf2d6e 100644
--- a/vis.c
+++ b/vis.c
@@ -1,27 +1,7 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <strings.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <ctype.h>
-#include <time.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <pwd.h>
-#include <libgen.h>
-#include <termkey.h>
-
#include "util.h"
+#include <termkey.h>
+
#include "vis.h"
#include "text-util.h"
#include "text-motions.h"
@@ -31,7 +11,6 @@
#include "ui.h"
#include "vis-subprocess.h"
-
#include "array.c"
#include "buffer.c"
#include "event-basic.c"