diff options
author | Max Kellermann <max@duempel.org> | 2008-09-15 12:27:29 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-15 12:27:29 +0200 |
commit | 8fd244cc61c74522b93b59e75594902a01f936b5 (patch) | |
tree | bbf97cbda04f0ec9b0dd927ab941a541dc1f8fd7 /src | |
parent | 2546fc394347548583c7bdcc15c23c7b17df6ea4 (diff) | |
download | mpd-8fd244cc61c74522b93b59e75594902a01f936b5.tar.gz mpd-8fd244cc61c74522b93b59e75594902a01f936b5.tar.xz mpd-8fd244cc61c74522b93b59e75594902a01f936b5.zip |
include cleanup
A header should include all headers which he needs. Move local
includes on top, and let foo.c include foo.h in the first line, to
automatically test its dependencies.
Diffstat (limited to 'src')
-rw-r--r-- | src/colors.c | 11 | ||||
-rw-r--r-- | src/colors.h | 2 | ||||
-rw-r--r-- | src/command.c | 14 | ||||
-rw-r--r-- | src/command.h | 4 | ||||
-rw-r--r-- | src/conf.c | 17 | ||||
-rw-r--r-- | src/conf.h | 1 | ||||
-rw-r--r-- | src/easy_download.c | 11 | ||||
-rw-r--r-- | src/list_window.c | 12 | ||||
-rw-r--r-- | src/list_window.h | 5 | ||||
-rw-r--r-- | src/lyrics_hd.c | 6 | ||||
-rw-r--r-- | src/main.c | 13 | ||||
-rw-r--r-- | src/mpdclient.c | 15 | ||||
-rw-r--r-- | src/mpdclient.h | 3 | ||||
-rw-r--r-- | src/options.c | 11 | ||||
-rw-r--r-- | src/options.h | 6 | ||||
-rw-r--r-- | src/screen.c | 19 | ||||
-rw-r--r-- | src/screen.h | 6 | ||||
-rw-r--r-- | src/screen_artist.c | 13 | ||||
-rw-r--r-- | src/screen_clock.c | 13 | ||||
-rw-r--r-- | src/screen_file.c | 12 | ||||
-rw-r--r-- | src/screen_help.c | 10 | ||||
-rw-r--r-- | src/screen_keydef.c | 12 | ||||
-rw-r--r-- | src/screen_lyrics.c | 20 | ||||
-rw-r--r-- | src/screen_play.c | 14 | ||||
-rw-r--r-- | src/screen_search.c | 13 | ||||
-rw-r--r-- | src/screen_utils.c | 15 | ||||
-rw-r--r-- | src/screen_utils.h | 7 | ||||
-rw-r--r-- | src/src_lyrics.h | 5 | ||||
-rw-r--r-- | src/strfsong.c | 11 | ||||
-rw-r--r-- | src/strfsong.h | 6 | ||||
-rw-r--r-- | src/support.c | 8 | ||||
-rw-r--r-- | src/support.h | 2 | ||||
-rw-r--r-- | src/utils.c | 13 | ||||
-rw-r--r-- | src/utils.h | 3 | ||||
-rw-r--r-- | src/wreadln.c | 4 | ||||
-rw-r--r-- | src/wreadln.h | 3 |
36 files changed, 173 insertions, 167 deletions
diff --git a/src/colors.c b/src/colors.c index e60399ea7..9f4f6cdcc 100644 --- a/src/colors.c +++ b/src/colors.c @@ -18,18 +18,15 @@ * */ +#include "colors.h" +#include "ncmpc.h" +#include "options.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ncurses.h> #include <glib.h> -#include "config.h" -#include "ncmpc.h" -#include "options.h" -#include "support.h" -#include "colors.h" - #define COLOR_BRIGHT_MASK (1<<7) #define COLOR_BRIGHT_BLACK (COLOR_BLACK | COLOR_BRIGHT_MASK) diff --git a/src/colors.h b/src/colors.h index 421163006..a913021a1 100644 --- a/src/colors.h +++ b/src/colors.h @@ -1,6 +1,8 @@ #ifndef COLORS_H #define COLORS_H +#include <ncurses.h> + #define COLOR_TITLE 1 #define COLOR_TITLE_BOLD 2 #define COLOR_LINE 3 diff --git a/src/command.c b/src/command.c index 733bf6a31..3a5e6794c 100644 --- a/src/command.c +++ b/src/command.c @@ -18,20 +18,18 @@ * */ +#include "command.h" +#include "config.h" +#include "ncmpc.h" +#include "mpdclient.h" +#include "screen.h" + #include <ctype.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <glib.h> #include <signal.h> -#include <ncurses.h> - -#include "config.h" -#include "ncmpc.h" -#include "command.h" -#include "mpdclient.h" -#include "screen.h" #undef DEBUG_KEYS diff --git a/src/command.h b/src/command.h index 75886d5ef..9e3b8394b 100644 --- a/src/command.h +++ b/src/command.h @@ -1,6 +1,10 @@ #ifndef COMMAND_H #define COMMAND_H +#include <stddef.h> +#include <stdio.h> +#include <ncurses.h> + #define MAX_COMMAND_KEYS 3 /* commands */ diff --git a/src/conf.c b/src/conf.c index 0e477db88..e4b6b70c5 100644 --- a/src/conf.c +++ b/src/conf.c @@ -18,6 +18,13 @@ * */ +#include "conf.h" +#include "config.h" +#include "ncmpc.h" +#include "support.h" +#include "command.h" +#include "colors.h" + #include <ctype.h> #include <stdio.h> #include <errno.h> @@ -28,16 +35,6 @@ #include <sys/stat.h> #include <fcntl.h> -#include <glib.h> -#include <ncurses.h> -#include "config.h" -#include "ncmpc.h" -#include "options.h" -#include "support.h" -#include "command.h" -#include "colors.h" -#include "conf.h" - #define MAX_LINE_LENGTH 1024 #define COMMENT_TOKEN '#' diff --git a/src/conf.h b/src/conf.h index 20b4f5eca..97e73b3d8 100644 --- a/src/conf.h +++ b/src/conf.h @@ -1,3 +1,4 @@ +#include "options.h" int check_user_conf_dir(void); diff --git a/src/easy_download.c b/src/easy_download.c index 83616cf87..d57202580 100644 --- a/src/easy_download.c +++ b/src/easy_download.c @@ -14,19 +14,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -# + +#include "ncmpc.h" + +#ifdef ENABLE_LYRICS_SCREEN +#include "easy_download.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <glib.h> -#include "ncmpc.h" - -#ifdef ENABLE_LYRICS_SCREEN #include <curl/curl.h> -#include "easy_download.h" static size_t write_data(void *buffer, size_t size, size_t nmemb, easy_download_struct *dld) diff --git a/src/list_window.c b/src/list_window.c index a6bc911c3..859652c1d 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -18,18 +18,16 @@ * */ -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - +#include "list_window.h" #include "config.h" #include "options.h" #include "support.h" #include "command.h" #include "colors.h" -#include "list_window.h" + +#include <stdlib.h> +#include <unistd.h> +#include <string.h> extern void screen_bell(void); diff --git a/src/list_window.h b/src/list_window.h index 114f71eff..ad66760bb 100644 --- a/src/list_window.h +++ b/src/list_window.h @@ -1,8 +1,11 @@ #ifndef LIST_WINDOW_H #define LIST_WINDOW_H +#include "command.h" + #include <ncurses.h> -#include <command.h> +#include <glib.h> + #define LW_ROW(lw) (lw ? lw->selected-lw->start : 0) #define LW_HIDE_CURSOR 0x01 diff --git a/src/lyrics_hd.c b/src/lyrics_hd.c index 322160c98..e7acfc252 100644 --- a/src/lyrics_hd.c +++ b/src/lyrics_hd.c @@ -1,10 +1,8 @@ -#include <glib.h> +#include "src_lyrics.h" + #include <stdlib.h> -#include <stdio.h> #include <unistd.h> -#include "src_lyrics.h" - char *check_lyr_hd(char *artist, char *title, int how) { //checking whether for lyrics file existence and proper access result |= 2; diff --git a/src/main.c b/src/main.c index 6a6ba34f3..97bfdd3f9 100644 --- a/src/main.c +++ b/src/main.c @@ -18,14 +18,6 @@ * */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <signal.h> -#include <string.h> -#include <ncurses.h> -#include <glib.h> - #include "config.h" #include "ncmpc.h" #include "mpdclient.h" @@ -38,6 +30,11 @@ #include "screen_utils.h" #include "strfsong.h" +#include <stdlib.h> +#include <unistd.h> +#include <signal.h> +#include <string.h> + #define BUFSIZE 1024 static mpdclient_t *mpd = NULL; diff --git a/src/mpdclient.c b/src/mpdclient.c index 941c09114..ab7857356 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -18,20 +18,19 @@ * */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <time.h> -#include <string.h> -#include <glib.h> - +#include "mpdclient.h" +#include "screen_utils.h" #include "config.h" #include "ncmpc.h" #include "support.h" -#include "mpdclient.h" #include "options.h" #include "strfsong.h" +#include <stdlib.h> +#include <unistd.h> +#include <time.h> +#include <string.h> + #undef ENABLE_FANCY_PLAYLIST_MANAGMENT_CMD_ADD /* broken with song id's */ #define ENABLE_FANCY_PLAYLIST_MANAGMENT_CMD_DELETE #define ENABLE_FANCY_PLAYLIST_MANAGMENT_CMD_MOVE diff --git a/src/mpdclient.h b/src/mpdclient.h index c8cb8686b..a93cec918 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -1,7 +1,10 @@ #ifndef MPDCLIENT_H #define MPDCLIENT_H + #include "libmpdclient.h" +#include <glib.h> + #define MPD_VERSION_EQ(c,x,y,z) (c->connection->version[0] == x && \ c->connection->version[1] == y && \ c->connection->version[2] == z ) diff --git a/src/options.c b/src/options.c index 668fe7522..9b1aafe4f 100644 --- a/src/options.c +++ b/src/options.c @@ -18,19 +18,16 @@ * */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ncurses.h> -#include <glib.h> - +#include "options.h" #include "config.h" #include "ncmpc.h" #include "support.h" -#include "options.h" #include "command.h" #include "conf.h" +#include <stdlib.h> +#include <string.h> + #define MAX_LONGOPT_LENGTH 32 #define ERROR_UNKNOWN_OPTION 0x01 diff --git a/src/options.h b/src/options.h index e2b3b9b48..380b43eca 100644 --- a/src/options.h +++ b/src/options.h @@ -1,3 +1,7 @@ +#ifndef OPTIONS_H +#define OPTIONS_H + +#include <glib.h> #define MPD_HOST_ENV "MPD_HOST" #define MPD_PORT_ENV "MPD_PORT" @@ -39,3 +43,5 @@ extern options_t options; options_t *options_init(void); options_t *options_parse(int argc, const char **argv); + +#endif diff --git a/src/screen.c b/src/screen.c index 4624974c1..f9fa9b1fb 100644 --- a/src/screen.c +++ b/src/screen.c @@ -18,15 +18,8 @@ * */ -#include <stdlib.h> -#include <unistd.h> -#include <stdarg.h> -#include <string.h> -#include <time.h> -#include <locale.h> -#include <glib.h> -#include <ncurses.h> - +#include "screen.h" +#include "screen_utils.h" #include "config.h" #include "ncmpc.h" #include "support.h" @@ -37,9 +30,13 @@ #include "colors.h" #include "strfsong.h" #include "wreadln.h" -#include "screen.h" -#include "screen_utils.h" +#include <stdlib.h> +#include <unistd.h> +#include <stdarg.h> +#include <string.h> +#include <time.h> +#include <locale.h> #define SCREEN_PLAYLIST_ID 0 #define SCREEN_BROWSE_ID 1 diff --git a/src/screen.h b/src/screen.h index 0ecd9ef2c..d6f1620da 100644 --- a/src/screen.h +++ b/src/screen.h @@ -1,7 +1,11 @@ #ifndef SCREEN_H #define SCREEN_H -#include <ncurses.h> + #include "list_window.h" +#include "mpdclient.h" + +#include <ncurses.h> +#include <glib.h> #define IS_PLAYING(s) (s==MPD_STATUS_STATE_PLAY) #define IS_PAUSED(s) (s==MPD_STATUS_STATE_PAUSE) diff --git a/src/screen_artist.c b/src/screen_artist.c index b9acd3e96..fa42f1f77 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -18,13 +18,8 @@ * */ -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - #include "config.h" + #ifndef DISABLE_ARTIST_SCREEN #include "ncmpc.h" #include "options.h" @@ -37,6 +32,12 @@ #include "screen_utils.h" #include "screen_browse.h" +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <glib.h> +#include <ncurses.h> + #define BUFSIZE 1024 typedef enum { LIST_ARTISTS, LIST_ALBUMS, LIST_SONGS } artist_mode_t; diff --git a/src/screen_clock.c b/src/screen_clock.c index 0839304a1..a92953262 100644 --- a/src/screen_clock.c +++ b/src/screen_clock.c @@ -5,12 +5,6 @@ * ncurses. */ -#include <time.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - #include "config.h" #ifndef DISABLE_CLOCK_SCREEN @@ -21,6 +15,13 @@ #include "screen.h" #include "screen_utils.h" +#include <time.h> +#include <stdlib.h> +#include <string.h> +#include <glib.h> +#include <ncurses.h> + + #define YDEPTH 5 #define BUFSIZE 64 diff --git a/src/screen_file.c b/src/screen_file.c index 0dbaab45c..a9dec9475 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -18,12 +18,6 @@ * */ -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - #include "config.h" #include "ncmpc.h" #include "options.h" @@ -36,6 +30,12 @@ #include "screen_browse.h" #include "screen_play.h" +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <glib.h> +#include <ncurses.h> + #define USE_OLD_LAYOUT #undef USE_OLD_ADD diff --git a/src/screen_help.c b/src/screen_help.c index 80495a297..b62c61890 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -18,11 +18,6 @@ * */ -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - #include "config.h" #include "ncmpc.h" #include "mpdclient.h" @@ -30,6 +25,11 @@ #include "screen.h" #include "screen_utils.h" +#include <stdlib.h> +#include <string.h> +#include <glib.h> +#include <ncurses.h> + typedef struct { signed char highlight; diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 8571ca279..11c0a4aee 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -18,12 +18,6 @@ * */ -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - #include "config.h" #ifndef DISABLE_KEYDEF_SCREEN @@ -35,6 +29,12 @@ #include "screen.h" #include "screen_utils.h" +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <glib.h> +#include <ncurses.h> + #define STATIC_ITEMS 0 #define STATIC_SUB_ITEMS 1 #define BUFSIZE 256 diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 793eae7ee..2dd5e12b7 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -19,16 +19,6 @@ * */ -#define _GNU_SOURCE -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> -#include <expat.h> -#include <unistd.h> -#include <glib/gstdio.h> -#include <stdio.h> - #include "config.h" #ifndef DISABLE_LYRICS_SCREEN #include <sys/stat.h> @@ -42,6 +32,16 @@ #include "strfsong.h" #include "src_lyrics.h" +#define _GNU_SOURCE +#include <stdlib.h> +#include <string.h> +#include <glib.h> +#include <ncurses.h> +#include <expat.h> +#include <unistd.h> +#include <glib/gstdio.h> +#include <stdio.h> + int src_selection; static void lyrics_paint(screen_t *screen, mpdclient_t *c); diff --git a/src/screen_play.c b/src/screen_play.c index 6cd28d6ac..736be9271 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -18,13 +18,6 @@ * */ -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <glib.h> -#include <ncurses.h> - #include "config.h" #include "ncmpc.h" #include "options.h" @@ -39,6 +32,13 @@ #include "screen_utils.h" #include "screen_play.h" +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <glib.h> +#include <ncurses.h> + #define MAX_SONG_LENGTH 512 typedef struct diff --git a/src/screen_search.c b/src/screen_search.c index a74ef6092..85dc5c74e 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -18,13 +18,8 @@ * */ -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - #include "config.h" + #ifndef DISABLE_SEARCH_SCREEN #include "ncmpc.h" #include "options.h" @@ -37,6 +32,12 @@ #include "screen_utils.h" #include "screen_browse.h" +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <glib.h> +#include <ncurses.h> + /* new search stuff with qball's libmpdclient */ #define FUTURE diff --git a/src/screen_utils.c b/src/screen_utils.c index 80a1b3f00..d75116fb4 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -18,22 +18,17 @@ * */ -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <glib.h> -#include <ncurses.h> - +#include "screen_utils.h" #include "config.h" #include "ncmpc.h" -#include "mpdclient.h" #include "support.h" -#include "command.h" #include "options.h" -#include "list_window.h" #include "colors.h" #include "wreadln.h" -#include "screen.h" + +#include <stdlib.h> +#include <unistd.h> +#include <string.h> #define FIND_PROMPT _("Find: ") #define RFIND_PROMPT _("Find backward: ") diff --git a/src/screen_utils.h b/src/screen_utils.h index 0bb52262e..6928ba804 100644 --- a/src/screen_utils.h +++ b/src/screen_utils.h @@ -1,6 +1,13 @@ #ifndef SCREEN_UTILS_H #define SCREEN_UTILS_H +#include "screen.h" +#include "list_window.h" +#include "mpdclient.h" +#include "command.h" + +#include <ncurses.h> + /* sound an audible and/or visible bell */ void screen_bell(void); diff --git a/src/src_lyrics.h b/src/src_lyrics.h index 7a2e7eaee..941c4b63a 100644 --- a/src/src_lyrics.h +++ b/src/src_lyrics.h @@ -1,10 +1,11 @@ #ifndef SOURCE_LYRICS #define SOURCE_LYRICS -#include <stdlib.h> -#include <glib.h> #include "list_window.h" #include "mpdclient.h" + +#include <stdlib.h> +#include <glib.h> #include <gmodule.h> typedef struct _formed_text diff --git a/src/strfsong.c b/src/strfsong.c index 22f2e2e6d..523c30da2 100644 --- a/src/strfsong.c +++ b/src/strfsong.c @@ -22,17 +22,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "strfsong.h" +#include "support.h" -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> #include <string.h> -#include <glib.h> - -#include "config.h" -#include "libmpdclient.h" -#include "support.h" -#include "strfsong.h" static const gchar * skip(const gchar * p) diff --git a/src/strfsong.h b/src/strfsong.h index 74f9d7306..7c0361d9c 100644 --- a/src/strfsong.h +++ b/src/strfsong.h @@ -1,3 +1,9 @@ +#ifndef STRFSONG_H +#define STRFSONG_H + +#include <glib.h> +#include "libmpdclient.h" gsize strfsong(gchar *s, gsize max, const gchar *format, mpd_Song *song); +#endif diff --git a/src/support.c b/src/support.c index b7117e5be..315c569f7 100644 --- a/src/support.c +++ b/src/support.c @@ -18,16 +18,14 @@ * */ +#include "support.h" +#include "ncmpc.h" + #include <time.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <glib.h> - -#include "config.h" -#include "ncmpc.h" -#include "support.h" #define BUFSIZE 1024 diff --git a/src/support.h b/src/support.h index c9cfed090..8e868e7ff 100644 --- a/src/support.h +++ b/src/support.h @@ -1,6 +1,8 @@ #ifndef SUPPORT_H #define SUPPORT_H +#include <glib.h> + #ifdef HAVE_LIBGEN_H #include <libgen.h> #endif diff --git a/src/utils.c b/src/utils.c index 5f7f5ef1a..ac836a2f6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -18,19 +18,14 @@ * */ -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> - -#include "config.h" +#include "utils.h" #include "ncmpc.h" #include "options.h" #include "support.h" -#include "mpdclient.h" -#include "utils.h" +#include <ctype.h> +#include <stdlib.h> +#include <string.h> GList * string_list_free(GList *string_list) diff --git a/src/utils.h b/src/utils.h index fe913afce..0fb1c6868 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,6 +1,9 @@ #ifndef UTILS_H #define UTILS_H +#include "mpdclient.h" + +#include <glib.h> /* functions for lists containing strings */ GList *string_list_free(GList *string_list); diff --git a/src/wreadln.c b/src/wreadln.c index f6b848cdd..e6bc61237 100644 --- a/src/wreadln.c +++ b/src/wreadln.c @@ -20,6 +20,8 @@ #include "config.h" +#include "wreadln.h" + #include <stdlib.h> #include <string.h> #include <glib.h> @@ -30,8 +32,6 @@ #include <ncurses.h> #endif -#include "wreadln.h" - #define KEY_CTRL_A 1 #define KEY_CTRL_C 3 #define KEY_CTRL_D 4 diff --git a/src/wreadln.h b/src/wreadln.h index d448f4119..2dd2191f0 100644 --- a/src/wreadln.h +++ b/src/wreadln.h @@ -1,6 +1,9 @@ #ifndef WREADLN_H #define WREADLN_H +#include <glib.h> +#include <ncurses.h> + /* max size allocated for a line */ extern guint wrln_max_line_size; |