Code

include cleanup
authorMax Kellermann <max@duempel.org>
Mon, 15 Sep 2008 10:27:29 +0000 (12:27 +0200)
committerMax Kellermann <max@duempel.org>
Mon, 15 Sep 2008 10:27:29 +0000 (12:27 +0200)
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.

36 files changed:
src/colors.c
src/colors.h
src/command.c
src/command.h
src/conf.c
src/conf.h
src/easy_download.c
src/list_window.c
src/list_window.h
src/lyrics_hd.c
src/main.c
src/mpdclient.c
src/mpdclient.h
src/options.c
src/options.h
src/screen.c
src/screen.h
src/screen_artist.c
src/screen_clock.c
src/screen_file.c
src/screen_help.c
src/screen_keydef.c
src/screen_lyrics.c
src/screen_play.c
src/screen_search.c
src/screen_utils.c
src/screen_utils.h
src/src_lyrics.h
src/strfsong.c
src/strfsong.h
src/support.c
src/support.h
src/utils.c
src/utils.h
src/wreadln.c
src/wreadln.h

index e60399ea7a20e22f3def6137b8d582650e28b062..9f4f6cdcc601d66eba344c621cac6a95c166c216 100644 (file)
  *
  */
 
+#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)
index 4211630065e6f9dad899690bc26af6f77b3898ad..a913021a180fd59ffd7bb113c3cfb4d92617687e 100644 (file)
@@ -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
index 733bf6a314567d26a04b78a4c84e26848b1f5640..3a5e6794c46a9e517408831b65d727f38f51679b 100644 (file)
  *
  */
 
+#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
 
index 75886d5eff0cd40c77662cf0aa0fd2d9ec4de31f..9e3b8394b4ad4e70571d91b4b3e7c4697310d35d 100644 (file)
@@ -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 */
index 0e477db880fec5ca46089c05c0f0edcf7582a34a..e4b6b70c52ff37dede58b17cdcaeabf497c454c1 100644 (file)
  *
  */
 
+#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>
 #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   '#'
 
index 20b4f5ecad1c011d2745db3cc527c033db163216..97e73b3d8abe3e27cc0bd2f9755f0f97262ed0ad 100644 (file)
@@ -1,3 +1,4 @@
+#include "options.h"
 
 int check_user_conf_dir(void);
 
index 83616cf8741fa519f27cc1ab1a647ce5e424d99f..d572025804c195e0ef967e1fa510558cbd76d98b 100644 (file)
  *  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)
index a6bc911c384a4b8bf2c456085318c72a031bc47d..859652c1dcc8410d111c38ff680f7b532a883c30 100644 (file)
  *
  */
 
-#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);
 
index 114f71effcf6eabaa167c21b54e9906b9ff51664..ad66760bb9792bda3d106fd8383af9aaeddb63f5 100644 (file)
@@ -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
index 322160c98d465c2770396beb0588a4c9730993f6..e7acfc252eda7ba3ec55473c19b8bdb6ad377b69 100644 (file)
@@ -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;      
index 6a6ba34f36bf4ff5c3b9ca8adfe3e8c414a10cfc..97bfdd3f96bc2abace0146e570d082e52b8d45b9 100644 (file)
  *
  */
 
-#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"
 #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;
index 941c0911444cbf10c007c161dd3cc463bf790b52..ab78573565a50458ff61acab7638829b1e119768 100644 (file)
  *
  */
 
-#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
index c8cb8686b6b1d0fce6e6f07362970e86f2c62945..a93cec918c193d40c96157fb1c0a591b7c2533c2 100644 (file)
@@ -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 )
index 668fe7522c402b242d474903fbed0747e511bbda..9b1aafe4f93c238326faafd043004bcbd542745c 100644 (file)
  *
  */
 
-#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
index e2b3b9b48933dc0b9a2bfe7b4a872038fe65e55f..380b43eca01d4023d3b429237b3f326bd705038a 100644 (file)
@@ -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
index 4624974c1ad6e157db1fe58189119b32b8ae6b4d..f9fa9b1fb39cabf19610fb9eab91e4ecf0a6a2e6 100644 (file)
  *
  */
 
-#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"
 #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
index 0ecd9ef2c2a33f3fa7d34cd7f7b04f0196479287..d6f1620da3790b156ba35431faea5972e8247541 100644 (file)
@@ -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)
index b9acd3e96d3133539d3b862dca9d4f60d80c35f1..fa42f1f7794aa34f22fddae02e0ecfb28ed34f28 100644 (file)
  *
  */
 
-#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"
 #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;
index 0839304a152dfd0c935ac87bd640b1b748a56aa2..a929532622c9184465f8a9b1e1df0a68258f933e 100644 (file)
@@ -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
 #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
 
index 0dbaab45c64bd47896f93f8813bfb42f461e2a58..a9dec947533e6c6bdc94353db8f018186d15ff04 100644 (file)
  *
  */
 
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <ncurses.h>
-
 #include "config.h"
 #include "ncmpc.h"
 #include "options.h"
 #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
 
index 80495a297eb84f5b3afacc285179096e1fa9255a..b62c61890169e0be04fcc19ba7fccd7f8d099a72 100644 (file)
  *
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <ncurses.h>
-
 #include "config.h"
 #include "ncmpc.h"
 #include "mpdclient.h"
 #include "screen.h"
 #include "screen_utils.h"
 
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <ncurses.h>
+
 
 typedef struct {
        signed char highlight;
index 8571ca2790f01ac260171daf239a9f7f176ec50d..11c0a4aee9115ad40a525809ed34e460b85f702c 100644 (file)
  *
  */
 
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <ncurses.h>
-
 #include "config.h"
 
 #ifndef  DISABLE_KEYDEF_SCREEN
 #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
index 793eae7eeb672f53aef2d9f81ec27d6e4012f11d..2dd5e12b76ab43828fbab40f2acb66e4f1ecc991 100644 (file)
  *
  */
 
-#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>
 #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);
index 6cd28d6ace2c8997a5b8628d001ab31faf77d901..736be92716b3264bfddcbbfe819308bae90ddbad 100644 (file)
  *
  */
 
-#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"
 #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
index a74ef6092ccedf1669ada7f2a0940e22f97867b5..85dc5c74e3710185eb8d9589a16dc9d95aa0fcc9 100644 (file)
  *
  */
 
-#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"
 #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
 
index 80a1b3f004cf4c67294ee9e259560621441118a1..d75116fb431e4f2d1cf7c29b885dc41a30242f13 100644 (file)
  *
  */
 
-#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: ")
index 0bb52262e81764bd573118f7221e0d7b0e2132d3..6928ba804518e18439fbe9e8f352e042820a97dc 100644 (file)
@@ -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);
 
index 7a2e7eaee322b98de4dc7476c43cbd145f9270b6..941c4b63ab8d9b7b15b5181eceafcbfca4c0fe98 100644 (file)
@@ -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
index 22f2e2e6d10d5ca1bc7229e020eab55cfa6d843e..523c30da25a42319322e13e1365ecae4a3b0fbbc 100644 (file)
  * 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)
index 74f9d7306b4f01ff31ff3022f3c1c281648b40d9..7c0361d9c2acc7cfa5836975fcef605194f0b182 100644 (file)
@@ -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
index b7117e5bee2827525918c21ccb92ce2bd07065dc..315c569f742424a721dfa6f7db0ac3fa1d458504 100644 (file)
  *
  */
 
+#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
 
index c9cfed090ae28e1fa3267f78ddfc6c04f6580696..8e868e7ff9170af9ab26686617be28710e85f866 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef SUPPORT_H
 #define SUPPORT_H
 
+#include <glib.h>
+
 #ifdef HAVE_LIBGEN_H
 #include <libgen.h>
 #endif
index 5f7f5ef1a139aa756409fc068a4f226d25202a97..ac836a2f6efd54075151d38f371060bb63babd30 100644 (file)
  *
  */
 
-#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)
index fe913afcef7253307f9bd79246dee9ee5a18441e..0fb1c6868d8f59af94b0be946ce78f4852a52577 100644 (file)
@@ -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);
index f6b848cdd86788df9ade64319e474e8c8f052fad..e6bc612378e4e73613d71a5ad1a5694c094cf8ed 100644 (file)
@@ -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 
index d448f4119bd71e105597f160cc3ab57c3b2b360f..2dd2191f050dedd164d554a8d83047a7c28c2519 100644 (file)
@@ -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;