diff options
author | Max Kellermann <max@duempel.org> | 2008-04-12 04:19:26 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-12 04:19:26 +0000 |
commit | c89b358c8acb50e7cb26a62017f231ef1c4c86b6 (patch) | |
tree | 68f2d28d307e11d33ca459427b9237cf152a7b3d | |
parent | 159fb3803b5b63a1b0711043e6bd7c09103306ae (diff) |
clean up CPP includes
Try to only include headers which are really needed. We should
particularly check all "headers including other headers". The
long-term goal is to have a manageable, small API for plugins
(decoders, output) without so many mpd internals cluttering the
namespace.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
55 files changed, 33 insertions, 110 deletions
diff --git a/src/audio.c b/src/audio.c index 5f4d1abb5..1e4c70cbc 100644 --- a/src/audio.c +++ b/src/audio.c @@ -18,13 +18,12 @@ #include "audio.h" #include "audioOutput.h" -#include "conf.h" #include "log.h" -#include "sig_handlers.h" #include "command.h" #include "playerData.h" -#include "utils.h" -#include "state_file.h" +#include "path.h" +#include "ack.h" +#include "myfprintf.h" #include "os_compat.h" #define AUDIO_DEVICE_STATE "audio_device_state:" diff --git a/src/audio.h b/src/audio.h index 806737ce6..f8b28d0d0 100644 --- a/src/audio.h +++ b/src/audio.h @@ -19,8 +19,6 @@ #ifndef AUDIO_H #define AUDIO_H -#include "../config.h" - #include "mpd_types.h" #include "tag.h" #include "os_compat.h" diff --git a/src/buffer2array.h b/src/buffer2array.h index ece663994..b1b1e6a4a 100644 --- a/src/buffer2array.h +++ b/src/buffer2array.h @@ -19,8 +19,6 @@ #ifndef BUFFER_2_ARRAY_H #define BUFFER_2_ARRAY_H -#include "../config.h" - /* tokenizes up to max elements in buffer (a null-terminated string) and * stores the result in array (which must be capable of holding up to * max elements). Tokenization is based on C string quoting rules. diff --git a/src/charConv.c b/src/charConv.c index 26e4bddeb..c205e93e4 100644 --- a/src/charConv.c +++ b/src/charConv.c @@ -23,6 +23,8 @@ #include "path.h" #include "os_compat.h" +#include "../config.h" + #ifdef HAVE_ICONV #include <iconv.h> static iconv_t char_conv_iconv; diff --git a/src/charConv.h b/src/charConv.h index a416b5c8f..728f549bb 100644 --- a/src/charConv.h +++ b/src/charConv.h @@ -19,8 +19,6 @@ #ifndef CHAR_CONV_H #define CHAR_CONV_H -#include "../config.h" - int setCharSetConversion(const char *to, const char *from); char *char_conv_str(char *dest, const char *string); diff --git a/src/command.c b/src/command.c index 661c28fdd..9fc1673d2 100644 --- a/src/command.c +++ b/src/command.c @@ -28,9 +28,10 @@ #include "permission.h" #include "buffer2array.h" #include "log.h" -#include "tag.h" #include "utils.h" #include "storedPlaylist.h" +#include "sllist.h" +#include "ack.h" #include "os_compat.h" #define COMMAND_PLAY "play" diff --git a/src/command.h b/src/command.h index 71516b122..4d38b0f5f 100644 --- a/src/command.h +++ b/src/command.h @@ -19,19 +19,15 @@ #ifndef COMMAND_H #define COMMAND_H -#include "../config.h" - -#include "list.h" -#include "myfprintf.h" -#include "log.h" -#include "ack.h" -#include "sllist.h" +#include "gcc.h" #include "os_compat.h" #define COMMAND_RETURN_KILL 10 #define COMMAND_RETURN_CLOSE 20 #define COMMAND_MASTER_READY 30 +struct strnode; + int processListOfCommands(int fd, int *permission, int *expired, int listOK, struct strnode *list); diff --git a/src/conf.h b/src/conf.h index 79b6514c6..5891eddf9 100644 --- a/src/conf.h +++ b/src/conf.h @@ -19,8 +19,6 @@ #ifndef CONF_H #define CONF_H -#include "../config.h" - #define CONF_MUSIC_DIR "music_directory" #define CONF_PLAYLIST_DIR "playlist_directory" #define CONF_DB_FILE "db_file" diff --git a/src/dbUtils.h b/src/dbUtils.h index e6a71485c..f2237eab7 100644 --- a/src/dbUtils.h +++ b/src/dbUtils.h @@ -19,8 +19,6 @@ #ifndef DB_UTILS_H #define DB_UTILS_H -#include "os_compat.h" - #include "locate.h" int printAllIn(int fd, char *name); diff --git a/src/decode.c b/src/decode.c index da9550dff..023dbaaac 100644 --- a/src/decode.c +++ b/src/decode.c @@ -20,15 +20,10 @@ #include "player.h" #include "playerData.h" -#include "utils.h" #include "pcm_utils.h" -#include "audio.h" #include "path.h" #include "log.h" -#include "sig_handlers.h" #include "ls.h" -#include "utf8.h" -#include "os_compat.h" /* called inside decoder_task (inputPlugins) */ void decoder_wakeup_player(void) diff --git a/src/decode.h b/src/decode.h index 702c0322d..32da5ec3d 100644 --- a/src/decode.h +++ b/src/decode.h @@ -19,17 +19,11 @@ #ifndef DECODE_H #define DECODE_H -#include "../config.h" -#include "path.h" -#include "tag.h" #include "song.h" -#include "mpd_types.h" #include "audio.h" #include "notify.h" -#include "os_compat.h" - #define DECODE_TYPE_FILE 0 #define DECODE_TYPE_URL 1 diff --git a/src/directory.c b/src/directory.c index fa517cba6..7168dab02 100644 --- a/src/directory.c +++ b/src/directory.c @@ -20,22 +20,18 @@ #include "command.h" #include "conf.h" -#include "dbUtils.h" #include "interface.h" -#include "list.h" #include "listen.h" #include "log.h" #include "ls.h" -#include "mpd_types.h" #include "path.h" -#include "player.h" #include "playlist.h" #include "sig_handlers.h" #include "stats.h" -#include "tagTracker.h" #include "utils.h" #include "volume.h" -#include "ls.h" +#include "ack.h" +#include "myfprintf.h" #define DIRECTORY_DIR "directory: " #define DIRECTORY_MTIME "mtime: " diff --git a/src/directory.h b/src/directory.h index 5782dd2cc..acb173fc0 100644 --- a/src/directory.h +++ b/src/directory.h @@ -19,10 +19,7 @@ #ifndef DIRECTORY_H #define DIRECTORY_H -#include "../config.h" - #include "song.h" -#include "list.h" typedef List DirectoryList; diff --git a/src/inputPlugin.c b/src/inputPlugin.c index 18d869268..1ab118ceb 100644 --- a/src/inputPlugin.c +++ b/src/inputPlugin.c @@ -18,10 +18,6 @@ #include "inputPlugin.h" -#include "list.h" -#include "myfprintf.h" -#include "os_compat.h" - static List *inputPlugin_list; void loadInputPlugin(InputPlugin * inputPlugin) diff --git a/src/inputPlugin.h b/src/inputPlugin.h index c643cbdc2..953bab153 100644 --- a/src/inputPlugin.h +++ b/src/inputPlugin.h @@ -19,11 +19,8 @@ #ifndef INPUT_PLUGIN_H #define INPUT_PLUGIN_H -#include "../config.h" #include "inputStream.h" -#include "decode.h" #include "outputBuffer.h" -#include "tag.h" /* valid values for streamTypes in the InputPlugin struct: */ #define INPUT_PLUGIN_STREAM_FILE 0x01 diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 41753c62f..113889d2a 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -29,6 +29,7 @@ #include "../playerData.h" #include "../outputBuffer.h" #include "../os_compat.h" +#include "../path.h" #include <wavpack/wavpack.h> diff --git a/src/interface.c b/src/interface.c index df9eb63f7..b538ffc3e 100644 --- a/src/interface.c +++ b/src/interface.c @@ -19,16 +19,17 @@ #include "interface.h" #include "command.h" #include "conf.h" -#include "list.h" #include "log.h" #include "listen.h" -#include "playlist.h" #include "permission.h" #include "sllist.h" #include "utils.h" #include "ioops.h" +#include "myfprintf.h" #include "os_compat.h" +#include "../config.h" + #define GREETING "OK MPD " PROTOCOL_VERSION "\n" #define INTERFACE_MAX_BUFFER_LENGTH (40960) diff --git a/src/interface.h b/src/interface.h index 389e47136..a364f7922 100644 --- a/src/interface.h +++ b/src/interface.h @@ -19,7 +19,6 @@ #ifndef INTERFACE_H #define INTERFACE_H -#include "../config.h" #include "os_compat.h" void initInterfaces(void); diff --git a/src/list.c b/src/list.c index 65ad4ec98..0f1f31ad4 100644 --- a/src/list.c +++ b/src/list.c @@ -18,7 +18,6 @@ #include "list.h" #include "utils.h" -#include "os_compat.h" static void makeListNodesArray(List * list) { diff --git a/src/list.h b/src/list.h index 6aca5f503..014ebf7c1 100644 --- a/src/list.h +++ b/src/list.h @@ -19,7 +19,6 @@ #ifndef LIST_H #define LIST_H -#include "../config.h" #include "os_compat.h" /* used to make a list where free() will be used to free data in list */ diff --git a/src/listen.c b/src/listen.c index 7d2a3597d..cf4628c07 100644 --- a/src/listen.c +++ b/src/listen.c @@ -23,6 +23,8 @@ #include "utils.h" #include "os_compat.h" +#include "../config.h" + #define MAXHOSTNAME 1024 #define ALLOW_REUSE 1 diff --git a/src/listen.h b/src/listen.h index 04c6d8286..f459cc53c 100644 --- a/src/listen.h +++ b/src/listen.h @@ -19,7 +19,6 @@ #ifndef LISTEN_H #define LISTEN_H -#include "../config.h" #include "os_compat.h" extern int boundPort; diff --git a/src/locate.c b/src/locate.c index f459d2769..d97097f37 100644 --- a/src/locate.c +++ b/src/locate.c @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "path.h" #include "locate.h" +#include "path.h" #include "utils.h" #define LOCATE_TAG_FILE_KEY "file" @@ -19,10 +19,7 @@ #ifndef LS_H #define LS_H -#include "../config.h" - #include "inputPlugin.h" -#include "os_compat.h" int lsPlaylists(int fd, const char *utf8path); diff --git a/src/mpd_types.h b/src/mpd_types.h index 35ff3604f..ed573c4a4 100644 --- a/src/mpd_types.h +++ b/src/mpd_types.h @@ -20,7 +20,6 @@ #define MPD_TYPES_H #include "../config.h" -#include "os_compat.h" typedef unsigned char mpd_uint8; typedef signed char mpd_sint8; diff --git a/src/myfprintf.c b/src/myfprintf.c index 2f8ea7723..0732caf02 100644 --- a/src/myfprintf.c +++ b/src/myfprintf.c @@ -19,8 +19,6 @@ #include "myfprintf.h" #include "interface.h" #include "path.h" -#include "log.h" -#include "conf.h" #include "utils.h" #include "os_compat.h" diff --git a/src/myfprintf.h b/src/myfprintf.h index c857b3e50..393a22a08 100644 --- a/src/myfprintf.h +++ b/src/myfprintf.h @@ -19,7 +19,6 @@ #ifndef MYFPRINTF_H #define MYFPRINTF_H -#include "../config.h" #include "gcc.h" #include "os_compat.h" diff --git a/src/normalize.c b/src/normalize.c index 0bdee3eb5..c38ffa0fe 100644 --- a/src/normalize.c +++ b/src/normalize.c @@ -16,10 +16,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "normalize.h" #include "compress.h" #include "conf.h" -#include "normalize.h" -#include "os_compat.h" #define DEFAULT_VOLUME_NORMALIZATION 0 diff --git a/src/os_compat.h b/src/os_compat.h index bc7593eef..54d55ed7f 100644 --- a/src/os_compat.h +++ b/src/os_compat.h @@ -19,6 +19,8 @@ #ifndef OS_COMPAT_H #define OS_COMPAT_H +#include "../config.h" + /* * This includes OS-wide headers that can be expected to be available * on any machine that mpd can be compiled on for any UNIX-like OS. diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 1f33ad7c2..006496453 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -18,13 +18,8 @@ #include "outputBuffer.h" -#include "pcm_utils.h" -#include "playerData.h" #include "utils.h" -#include "log.h" #include "normalize.h" -#include "conf.h" -#include "os_compat.h" void initOutputBuffer(OutputBuffer * cb, unsigned int size) { diff --git a/src/outputBuffer.h b/src/outputBuffer.h index 4c43ac051..7a06f9d41 100644 --- a/src/outputBuffer.h +++ b/src/outputBuffer.h @@ -22,7 +22,6 @@ #include "pcm_utils.h" #include "mpd_types.h" #include "decode.h" -#include "audio.h" #include "inputStream.h" #include "replayGain.h" diff --git a/src/path.h b/src/path.h index d29354523..a91728126 100644 --- a/src/path.h +++ b/src/path.h @@ -19,7 +19,6 @@ #ifndef PATH_H #define PATH_H -#include "../config.h" #include "os_compat.h" #if !defined(MPD_PATH_MAX) diff --git a/src/permission.h b/src/permission.h index bd4257080..af52ce411 100644 --- a/src/permission.h +++ b/src/permission.h @@ -19,8 +19,6 @@ #ifndef PERMISSION_H #define PERMISSION_H -#include "../config.h" - #define PERMISSION_NONE 0 #define PERMISSION_READ 1 #define PERMISSION_ADD 2 diff --git a/src/player.c b/src/player.c index b930056e2..046195763 100644 --- a/src/player.c +++ b/src/player.c @@ -30,7 +30,7 @@ #include "volume.h" #include "playerData.h" #include "permission.h" -#include "sig_handlers.h" +#include "ack.h" #include "os_compat.h" static void playerCloseAudio(void); diff --git a/src/player.h b/src/player.h index 943a059b4..7eb0dd9cd 100644 --- a/src/player.h +++ b/src/player.h @@ -19,8 +19,6 @@ #ifndef PLAYER_H #define PLAYER_H -#include "../config.h" - #include "decode.h" #include "mpd_types.h" #include "song.h" diff --git a/src/playerData.c b/src/playerData.c index 6cc98ccc6..ac1be5990 100644 --- a/src/playerData.c +++ b/src/playerData.c @@ -20,7 +20,6 @@ #include "conf.h" #include "log.h" #include "utils.h" -#include "os_compat.h" unsigned int buffered_before_play; diff --git a/src/playerData.h b/src/playerData.h index bb6347519..f0f740567 100644 --- a/src/playerData.h +++ b/src/playerData.h @@ -19,8 +19,6 @@ #ifndef PLAYER_DATA_H #define PLAYER_DATA_H -#include "../config.h" - #include "audio.h" #include "player.h" #include "decode.h" diff --git a/src/playlist.c b/src/playlist.c index bac3d03d0..ce029cc65 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -26,9 +26,10 @@ #include "log.h" #include "path.h" #include "utils.h" -#include "sig_handlers.h" #include "state_file.h" #include "storedPlaylist.h" +#include "ack.h" +#include "myfprintf.h" #include "os_compat.h" #define PLAYLIST_STATE_STOP 0 diff --git a/src/playlist.h b/src/playlist.h index 7d6c92a14..db5243ba9 100644 --- a/src/playlist.h +++ b/src/playlist.h @@ -19,10 +19,7 @@ #ifndef PLAYLIST_H #define PLAYLIST_H -#include "../config.h" - #include "dbUtils.h" -#include "os_compat.h" #define PLAYLIST_FILE_SUFFIX "m3u" #define PLAYLIST_COMMENT '#' diff --git a/src/sig_handlers.c b/src/sig_handlers.c index af664f182..88159f24f 100644 --- a/src/sig_handlers.c +++ b/src/sig_handlers.c @@ -18,8 +18,6 @@ */ #include "sig_handlers.h" -#include "player.h" -#include "playerData.h" #include "playlist.h" #include "directory.h" #include "command.h" @@ -27,7 +25,6 @@ #include "log.h" #include "player.h" #include "decode.h" -#include "os_compat.h" int handlePendingSignals(void) { diff --git a/src/sig_handlers.h b/src/sig_handlers.h index a9438cac1..ee61e80e1 100644 --- a/src/sig_handlers.h +++ b/src/sig_handlers.h @@ -19,8 +19,6 @@ #ifndef SIG_HANDLERS_H #define SIG_HANDLERS_H -#include "../config.h" - int handlePendingSignals(void); void initSigHandlers(void); diff --git a/src/signal_check.h b/src/signal_check.h index 931b5333c..224e9cb44 100644 --- a/src/signal_check.h +++ b/src/signal_check.h @@ -20,8 +20,6 @@ #ifndef SIGNAL_CHECK_H #define SIGNAL_CHECK_H -#include "os_compat.h" - void signal_handle(int sig); void signal_unhandle(int sig); int signal_is_pending(int sig); diff --git a/src/sllist.c b/src/sllist.c index 7df4aedab..cfe392d60 100644 --- a/src/sllist.c +++ b/src/sllist.c @@ -18,7 +18,6 @@ /* a very simple singly-linked-list structure for queues/buffers */ -#include "os_compat.h" #include "sllist.h" #include "utils.h" diff --git a/src/sllist.h b/src/sllist.h index 39860a59f..ba7d8ea95 100644 --- a/src/sllist.h +++ b/src/sllist.h @@ -21,6 +21,8 @@ #ifndef SLLIST_H #define SLLIST_H +#include "os_compat.h" + /* just free the entire structure if it's free-able, the 'data' member * should _NEVER_ be explicitly freed * diff --git a/src/stats.c b/src/stats.c index 505324032..254595472 100644 --- a/src/stats.c +++ b/src/stats.c @@ -21,7 +21,6 @@ #include "directory.h" #include "myfprintf.h" #include "player.h" -#include "tag.h" #include "tagTracker.h" #include "os_compat.h" diff --git a/src/stats.h b/src/stats.h index 5365bff69..aca8c06ab 100644 --- a/src/stats.h +++ b/src/stats.h @@ -19,8 +19,6 @@ #ifndef STATS_H #define STATS_H -#include "../config.h" - typedef struct _Stats { unsigned long daemonStart; int numberOfSongs; diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index c936d61f9..a38511ea1 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -17,10 +17,8 @@ */ #include "storedPlaylist.h" -#include "log.h" #include "path.h" #include "utils.h" -#include "playlist.h" #include "ack.h" #include "command.h" #include "ls.h" diff --git a/src/storedPlaylist.h b/src/storedPlaylist.h index 9b50ddc2e..a7806386b 100644 --- a/src/storedPlaylist.h +++ b/src/storedPlaylist.h @@ -22,7 +22,6 @@ #include "song.h" #include "list.h" #include "playlist.h" -#include "path.h" List *loadStoredPlaylist(int fd, const char *utf8path); @@ -17,17 +17,13 @@ */ #include "tag.h" -#include "path.h" #include "myfprintf.h" #include "utils.h" #include "utf8.h" #include "log.h" -#include "inputStream.h" #include "conf.h" #include "charConv.h" #include "tagTracker.h" -#include "mpd_types.h" -#include "gcc.h" #include "song.h" #include "os_compat.h" diff --git a/src/tagTracker.c b/src/tagTracker.c index 7509c775a..fa287253b 100644 --- a/src/tagTracker.c +++ b/src/tagTracker.c @@ -18,11 +18,10 @@ #include "tagTracker.h" +#include "tag.h" #include "tree.h" -#include "log.h" #include "utils.h" #include "myfprintf.h" -#include "os_compat.h" static Tree *tagTrees[TAG_NUM_OF_ITEM_TYPES]; diff --git a/src/tagTracker.h b/src/tagTracker.h index d3b605585..17958f3af 100644 --- a/src/tagTracker.h +++ b/src/tagTracker.h @@ -19,8 +19,6 @@ #ifndef TAG_TRACKER_H #define TAG_TRACKER_H -#include "tag.h" - char *getTagItemString(int type, char *string); void removeTagItemString(int type, char *string); diff --git a/src/utils.c b/src/utils.c index 1ff9a1910..a311796c8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -19,7 +19,8 @@ #include "utils.h" #include "log.h" #include "conf.h" -#include "os_compat.h" + +#include "../config.h" char *myFgets(char *buffer, int bufferSize, FILE * fp) { diff --git a/src/utils.h b/src/utils.h index e8a464ad5..0b6763a05 100644 --- a/src/utils.h +++ b/src/utils.h @@ -19,7 +19,6 @@ #ifndef UTILS_H #define UTILS_H -#include "../config.h" #include "gcc.h" #include "os_compat.h" diff --git a/src/volume.c b/src/volume.c index 36656c272..5b720651a 100644 --- a/src/volume.c +++ b/src/volume.c @@ -21,11 +21,13 @@ #include "conf.h" #include "log.h" #include "player.h" -#include "state_file.h" #include "gcc.h" #include "utils.h" +#include "ack.h" #include "os_compat.h" +#include "../config.h" + #ifdef HAVE_OSS #include <sys/soundcard.h> #endif diff --git a/src/volume.h b/src/volume.h index 48627dafe..85a9eefa8 100644 --- a/src/volume.h +++ b/src/volume.h @@ -19,7 +19,6 @@ #ifndef VOLUME_H #define VOLUME_H -#include "../config.h" #include "os_compat.h" #define VOLUME_MIXER_OSS "oss" |