Remove all unused includes with include-what-you-use (fixes #11)
This commit is contained in:
parent
9679b5b7a4
commit
7dccd70e38
13 changed files with 78 additions and 127 deletions
|
@ -12,8 +12,9 @@ CFLAGS = -Wall \
|
|||
-std=c99
|
||||
SRC=$(wildcard *.c)
|
||||
|
||||
fn: $(SRC)
|
||||
$(CC) -o $@ $^ $(CFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f fn
|
||||
|
||||
fn: $(SRC)
|
||||
$(CC) -o $@ $^ $(CFLAGS)
|
||||
|
|
28
src/file.c
28
src/file.c
|
@ -2,25 +2,19 @@
|
|||
#define _BSD_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h> // for errno
|
||||
#include <fcntl.h> // for open, O_CREAT, O_RDWR
|
||||
#include <stdio.h> // for NULL, fclose, fopen, FILE
|
||||
#include <stdlib.h> // for free
|
||||
#include <string.h> // for strdup, strerror
|
||||
#include <unistd.h> // for close, ftruncate, ssize_t
|
||||
#include <termios.h> // for termios
|
||||
|
||||
#include "fn.h"
|
||||
#include "file.h"
|
||||
#include "hl.h"
|
||||
#include "terminal.h"
|
||||
#include "row.h"
|
||||
#include "fn.h" // for editorSetStatusMessage, E, editorConfig, edito...
|
||||
#include "hl.h" // for editorSelectSyntaxHighlight
|
||||
#include "row.h" // for editorRowsToString
|
||||
#include "terminal.h" // for die
|
||||
|
||||
void editorOpen(char *filename) {
|
||||
free(E.filename);
|
||||
|
|
27
src/fn.c
27
src/fn.c
|
@ -2,28 +2,15 @@
|
|||
#define _BSD_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <signal.h> // for signal, SIGWINCH
|
||||
#include <stdio.h> // for NULL
|
||||
|
||||
#include "fn.h"
|
||||
#include "terminal.h"
|
||||
#include "output.h"
|
||||
#include "row.h"
|
||||
#include "hl.h"
|
||||
#include "search.h"
|
||||
#include "file.h"
|
||||
#include "input.h"
|
||||
#include "file.h" // for editorOpen
|
||||
#include "input.h" // for editorProcessKeypress
|
||||
#include "output.h" // for editorRefreshScreen, editorSetStatusMessage
|
||||
#include "terminal.h" // for die, setWindowSize, enableRawMode
|
||||
|
||||
|
||||
// TODO: Put this somewhere else?
|
||||
void windowResizeCallback(int signum);
|
||||
|
|
3
src/fn.h
3
src/fn.h
|
@ -1,6 +1,9 @@
|
|||
#ifndef _FN_H
|
||||
#define _FN_H
|
||||
|
||||
#include <bits/types/time_t.h> // for time_t
|
||||
#include <termios.h> // for termios
|
||||
|
||||
#define FN_VERSION "0.2"
|
||||
#define FN_TAB_STOP 4
|
||||
#define FN_QUIT_TIMES 2
|
||||
|
|
20
src/hl.c
20
src/hl.c
|
@ -1,19 +1,11 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h> // for isdigit, isspace
|
||||
#include <stdio.h> // for NULL
|
||||
#include <stdlib.h> // for realloc
|
||||
#include <string.h> // for memset, strlen, strncmp, strchr, strcmp, strrchr
|
||||
|
||||
#include "fn.h"
|
||||
#include "hl.h"
|
||||
#include "fn.h" // for erow, E, editorConfig, editorSyntax, editorHighl...
|
||||
|
||||
|
||||
char *C_HL_extensions[] = { ".c", ".h", ".cpp", NULL };
|
||||
char *C_HL_keywords[] = {
|
||||
|
|
3
src/hl.h
3
src/hl.h
|
@ -1,6 +1,9 @@
|
|||
#ifndef _HL_H
|
||||
#define _HL_H
|
||||
|
||||
#include "fn.h" // for erow
|
||||
|
||||
|
||||
int is_separator(int c);
|
||||
void editorUpdateSyntax(erow *row);
|
||||
int editorSyntaxToColor(int hl);
|
||||
|
|
28
src/input.c
28
src/input.c
|
@ -1,24 +1,14 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h> // for iscntrl
|
||||
#include <stdio.h> // for NULL
|
||||
#include <stdlib.h> // for exit, free
|
||||
#include <unistd.h> // for STDOUT_FILENO
|
||||
|
||||
#include "fn.h"
|
||||
#include "row.h"
|
||||
#include "terminal.h"
|
||||
#include "input.h"
|
||||
#include "output.h"
|
||||
#include "file.h"
|
||||
#include "search.h"
|
||||
#include "file.h" // for editorSave
|
||||
#include "fn.h" // for E, editorConfig, erow, CTRL_KEY, editorKey::AR...
|
||||
#include "output.h" // for editorSetStatusMessage, editorDelChar, editorI...
|
||||
#include "search.h" // for editorFind
|
||||
#include "terminal.h" // for editorReadKey
|
||||
|
||||
|
||||
char *editorPrompt(char *prompt, void (*callback)(char *, int)) {
|
||||
|
|
26
src/output.c
26
src/output.c
|
@ -1,21 +1,15 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h> // for iscntrl
|
||||
#include <stdarg.h> // for va_list
|
||||
#include <stdio.h> // for snprintf, vsnprintf, NULL
|
||||
#include <string.h> // for strlen
|
||||
#include <time.h> // for time
|
||||
#include <unistd.h> // for STDOUT_FILENO
|
||||
|
||||
#include "fn.h"
|
||||
#include "row.h"
|
||||
#include "hl.h"
|
||||
#include "output.h"
|
||||
#include "fn.h" // for E, editorConfig, erow, FN_VERSION, abuf, editorH...
|
||||
#include "hl.h" // for editorSyntaxToColor
|
||||
#include "row.h" // for abAppend, abFree, editorDelRow, editorRowCxToRx
|
||||
|
||||
|
||||
void editorScroll() {
|
||||
E.rx = 0;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _OUTPUT_H
|
||||
#define _OUTPUT_H
|
||||
|
||||
struct abuf;
|
||||
|
||||
void editorScroll();
|
||||
|
||||
void editorDrawRows(struct abuf *ab);
|
||||
|
|
21
src/row.c
21
src/row.c
|
@ -1,20 +1,11 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h> // for NULL
|
||||
#include <stdlib.h> // for free, realloc, malloc
|
||||
#include <string.h> // for memmove, memcpy
|
||||
|
||||
#include "fn.h"
|
||||
#include "hl.h"
|
||||
#include "row.h"
|
||||
#include "fn.h" // for erow, E, editorConfig, FN_TAB_STOP, abuf
|
||||
#include "hl.h" // for editorUpdateSyntax
|
||||
|
||||
|
||||
void abAppend(struct abuf *ab, const char *s, int len) {
|
||||
char *new = realloc(ab->b, ab->len + len);
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifndef _ROW_H
|
||||
#define _ROW_H
|
||||
|
||||
#include <stddef.h> // for NULL
|
||||
#include "fn.h" // for erow
|
||||
|
||||
|
||||
#define ABUF_INIT {NULL, 0}
|
||||
|
||||
|
||||
void abAppend(struct abuf *ab, const char *s, int len);
|
||||
void abFree(struct abuf *ab);
|
||||
|
||||
|
|
22
src/search.c
22
src/search.c
|
@ -1,20 +1,10 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "fn.h"
|
||||
#include "search.h"
|
||||
#include "row.h"
|
||||
#include <stdio.h> // for NULL
|
||||
#include <stdlib.h> // for free, malloc
|
||||
#include <string.h> // for memcpy, memset, strlen, strstr
|
||||
#include "fn.h" // for E, editorConfig, erow, editorPrompt, editorHighl...
|
||||
#include "row.h" // for editorRowRxToCx
|
||||
|
||||
|
||||
void editorFindCallback(char *query, int key) {
|
||||
static int last_match = -1;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <errno.h> // for EAGAIN, errno
|
||||
#include <stdio.h> // for perror, sscanf
|
||||
#include <stdlib.h> // for atexit, exit
|
||||
#include <sys/ioctl.h> // for winsize, ioctl, TIOCGWINSZ
|
||||
#include <termios.h> // for termios, tcsetattr, tcgetattr, TCSAFLUSH, cc_t
|
||||
#include <unistd.h> // for STDIN_FILENO, STDOUT_FILENO
|
||||
|
||||
#include "fn.h"
|
||||
#include "terminal.h"
|
||||
#include "fn.h" // for E, editorConfig, editorKey::END_KEY, editorKe...
|
||||
|
||||
void die(const char *s) {
|
||||
write(STDOUT_FILENO, "\x1b[2J", 4);
|
||||
|
|
Loading…
Reference in a new issue