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
This commit is contained in:
Max Kellermann 2008-04-12 04:19:26 +00:00 committed by Eric Wong
parent 159fb3803b
commit c89b358c8a
55 changed files with 33 additions and 110 deletions

View File

@ -18,13 +18,12 @@
#include "audio.h" #include "audio.h"
#include "audioOutput.h" #include "audioOutput.h"
#include "conf.h"
#include "log.h" #include "log.h"
#include "sig_handlers.h"
#include "command.h" #include "command.h"
#include "playerData.h" #include "playerData.h"
#include "utils.h" #include "path.h"
#include "state_file.h" #include "ack.h"
#include "myfprintf.h"
#include "os_compat.h" #include "os_compat.h"
#define AUDIO_DEVICE_STATE "audio_device_state:" #define AUDIO_DEVICE_STATE "audio_device_state:"

View File

@ -19,8 +19,6 @@
#ifndef AUDIO_H #ifndef AUDIO_H
#define AUDIO_H #define AUDIO_H
#include "../config.h"
#include "mpd_types.h" #include "mpd_types.h"
#include "tag.h" #include "tag.h"
#include "os_compat.h" #include "os_compat.h"

View File

@ -19,8 +19,6 @@
#ifndef BUFFER_2_ARRAY_H #ifndef BUFFER_2_ARRAY_H
#define BUFFER_2_ARRAY_H #define BUFFER_2_ARRAY_H
#include "../config.h"
/* tokenizes up to max elements in buffer (a null-terminated string) and /* 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 * stores the result in array (which must be capable of holding up to
* max elements). Tokenization is based on C string quoting rules. * max elements). Tokenization is based on C string quoting rules.

View File

@ -23,6 +23,8 @@
#include "path.h" #include "path.h"
#include "os_compat.h" #include "os_compat.h"
#include "../config.h"
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
#include <iconv.h> #include <iconv.h>
static iconv_t char_conv_iconv; static iconv_t char_conv_iconv;

View File

@ -19,8 +19,6 @@
#ifndef CHAR_CONV_H #ifndef CHAR_CONV_H
#define CHAR_CONV_H #define CHAR_CONV_H
#include "../config.h"
int setCharSetConversion(const char *to, const char *from); int setCharSetConversion(const char *to, const char *from);
char *char_conv_str(char *dest, const char *string); char *char_conv_str(char *dest, const char *string);

View File

@ -28,9 +28,10 @@
#include "permission.h" #include "permission.h"
#include "buffer2array.h" #include "buffer2array.h"
#include "log.h" #include "log.h"
#include "tag.h"
#include "utils.h" #include "utils.h"
#include "storedPlaylist.h" #include "storedPlaylist.h"
#include "sllist.h"
#include "ack.h"
#include "os_compat.h" #include "os_compat.h"
#define COMMAND_PLAY "play" #define COMMAND_PLAY "play"

View File

@ -19,19 +19,15 @@
#ifndef COMMAND_H #ifndef COMMAND_H
#define COMMAND_H #define COMMAND_H
#include "../config.h" #include "gcc.h"
#include "list.h"
#include "myfprintf.h"
#include "log.h"
#include "ack.h"
#include "sllist.h"
#include "os_compat.h" #include "os_compat.h"
#define COMMAND_RETURN_KILL 10 #define COMMAND_RETURN_KILL 10
#define COMMAND_RETURN_CLOSE 20 #define COMMAND_RETURN_CLOSE 20
#define COMMAND_MASTER_READY 30 #define COMMAND_MASTER_READY 30
struct strnode;
int processListOfCommands(int fd, int *permission, int *expired, int processListOfCommands(int fd, int *permission, int *expired,
int listOK, struct strnode *list); int listOK, struct strnode *list);

View File

@ -19,8 +19,6 @@
#ifndef CONF_H #ifndef CONF_H
#define CONF_H #define CONF_H
#include "../config.h"
#define CONF_MUSIC_DIR "music_directory" #define CONF_MUSIC_DIR "music_directory"
#define CONF_PLAYLIST_DIR "playlist_directory" #define CONF_PLAYLIST_DIR "playlist_directory"
#define CONF_DB_FILE "db_file" #define CONF_DB_FILE "db_file"

View File

@ -19,8 +19,6 @@
#ifndef DB_UTILS_H #ifndef DB_UTILS_H
#define DB_UTILS_H #define DB_UTILS_H
#include "os_compat.h"
#include "locate.h" #include "locate.h"
int printAllIn(int fd, char *name); int printAllIn(int fd, char *name);

View File

@ -20,15 +20,10 @@
#include "player.h" #include "player.h"
#include "playerData.h" #include "playerData.h"
#include "utils.h"
#include "pcm_utils.h" #include "pcm_utils.h"
#include "audio.h"
#include "path.h" #include "path.h"
#include "log.h" #include "log.h"
#include "sig_handlers.h"
#include "ls.h" #include "ls.h"
#include "utf8.h"
#include "os_compat.h"
/* called inside decoder_task (inputPlugins) */ /* called inside decoder_task (inputPlugins) */
void decoder_wakeup_player(void) void decoder_wakeup_player(void)

View File

@ -19,17 +19,11 @@
#ifndef DECODE_H #ifndef DECODE_H
#define DECODE_H #define DECODE_H
#include "../config.h"
#include "path.h"
#include "tag.h"
#include "song.h" #include "song.h"
#include "mpd_types.h"
#include "audio.h" #include "audio.h"
#include "notify.h" #include "notify.h"
#include "os_compat.h"
#define DECODE_TYPE_FILE 0 #define DECODE_TYPE_FILE 0
#define DECODE_TYPE_URL 1 #define DECODE_TYPE_URL 1

View File

@ -20,22 +20,18 @@
#include "command.h" #include "command.h"
#include "conf.h" #include "conf.h"
#include "dbUtils.h"
#include "interface.h" #include "interface.h"
#include "list.h"
#include "listen.h" #include "listen.h"
#include "log.h" #include "log.h"
#include "ls.h" #include "ls.h"
#include "mpd_types.h"
#include "path.h" #include "path.h"
#include "player.h"
#include "playlist.h" #include "playlist.h"
#include "sig_handlers.h" #include "sig_handlers.h"
#include "stats.h" #include "stats.h"
#include "tagTracker.h"
#include "utils.h" #include "utils.h"
#include "volume.h" #include "volume.h"
#include "ls.h" #include "ack.h"
#include "myfprintf.h"
#define DIRECTORY_DIR "directory: " #define DIRECTORY_DIR "directory: "
#define DIRECTORY_MTIME "mtime: " #define DIRECTORY_MTIME "mtime: "

View File

@ -19,10 +19,7 @@
#ifndef DIRECTORY_H #ifndef DIRECTORY_H
#define DIRECTORY_H #define DIRECTORY_H
#include "../config.h"
#include "song.h" #include "song.h"
#include "list.h"
typedef List DirectoryList; typedef List DirectoryList;

View File

@ -18,10 +18,6 @@
#include "inputPlugin.h" #include "inputPlugin.h"
#include "list.h"
#include "myfprintf.h"
#include "os_compat.h"
static List *inputPlugin_list; static List *inputPlugin_list;
void loadInputPlugin(InputPlugin * inputPlugin) void loadInputPlugin(InputPlugin * inputPlugin)

View File

@ -19,11 +19,8 @@
#ifndef INPUT_PLUGIN_H #ifndef INPUT_PLUGIN_H
#define INPUT_PLUGIN_H #define INPUT_PLUGIN_H
#include "../config.h"
#include "inputStream.h" #include "inputStream.h"
#include "decode.h"
#include "outputBuffer.h" #include "outputBuffer.h"
#include "tag.h"
/* valid values for streamTypes in the InputPlugin struct: */ /* valid values for streamTypes in the InputPlugin struct: */
#define INPUT_PLUGIN_STREAM_FILE 0x01 #define INPUT_PLUGIN_STREAM_FILE 0x01

View File

@ -29,6 +29,7 @@
#include "../playerData.h" #include "../playerData.h"
#include "../outputBuffer.h" #include "../outputBuffer.h"
#include "../os_compat.h" #include "../os_compat.h"
#include "../path.h"
#include <wavpack/wavpack.h> #include <wavpack/wavpack.h>

View File

@ -19,16 +19,17 @@
#include "interface.h" #include "interface.h"
#include "command.h" #include "command.h"
#include "conf.h" #include "conf.h"
#include "list.h"
#include "log.h" #include "log.h"
#include "listen.h" #include "listen.h"
#include "playlist.h"
#include "permission.h" #include "permission.h"
#include "sllist.h" #include "sllist.h"
#include "utils.h" #include "utils.h"
#include "ioops.h" #include "ioops.h"
#include "myfprintf.h"
#include "os_compat.h" #include "os_compat.h"
#include "../config.h"
#define GREETING "OK MPD " PROTOCOL_VERSION "\n" #define GREETING "OK MPD " PROTOCOL_VERSION "\n"
#define INTERFACE_MAX_BUFFER_LENGTH (40960) #define INTERFACE_MAX_BUFFER_LENGTH (40960)

View File

@ -19,7 +19,6 @@
#ifndef INTERFACE_H #ifndef INTERFACE_H
#define INTERFACE_H #define INTERFACE_H
#include "../config.h"
#include "os_compat.h" #include "os_compat.h"
void initInterfaces(void); void initInterfaces(void);

View File

@ -18,7 +18,6 @@
#include "list.h" #include "list.h"
#include "utils.h" #include "utils.h"
#include "os_compat.h"
static void makeListNodesArray(List * list) static void makeListNodesArray(List * list)
{ {

View File

@ -19,7 +19,6 @@
#ifndef LIST_H #ifndef LIST_H
#define LIST_H #define LIST_H
#include "../config.h"
#include "os_compat.h" #include "os_compat.h"
/* used to make a list where free() will be used to free data in list */ /* used to make a list where free() will be used to free data in list */

View File

@ -23,6 +23,8 @@
#include "utils.h" #include "utils.h"
#include "os_compat.h" #include "os_compat.h"
#include "../config.h"
#define MAXHOSTNAME 1024 #define MAXHOSTNAME 1024
#define ALLOW_REUSE 1 #define ALLOW_REUSE 1

View File

@ -19,7 +19,6 @@
#ifndef LISTEN_H #ifndef LISTEN_H
#define LISTEN_H #define LISTEN_H
#include "../config.h"
#include "os_compat.h" #include "os_compat.h"
extern int boundPort; extern int boundPort;

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "path.h"
#include "locate.h" #include "locate.h"
#include "path.h"
#include "utils.h" #include "utils.h"
#define LOCATE_TAG_FILE_KEY "file" #define LOCATE_TAG_FILE_KEY "file"

View File

@ -19,10 +19,7 @@
#ifndef LS_H #ifndef LS_H
#define LS_H #define LS_H
#include "../config.h"
#include "inputPlugin.h" #include "inputPlugin.h"
#include "os_compat.h"
int lsPlaylists(int fd, const char *utf8path); int lsPlaylists(int fd, const char *utf8path);

View File

@ -20,7 +20,6 @@
#define MPD_TYPES_H #define MPD_TYPES_H
#include "../config.h" #include "../config.h"
#include "os_compat.h"
typedef unsigned char mpd_uint8; typedef unsigned char mpd_uint8;
typedef signed char mpd_sint8; typedef signed char mpd_sint8;

View File

@ -19,8 +19,6 @@
#include "myfprintf.h" #include "myfprintf.h"
#include "interface.h" #include "interface.h"
#include "path.h" #include "path.h"
#include "log.h"
#include "conf.h"
#include "utils.h" #include "utils.h"
#include "os_compat.h" #include "os_compat.h"

View File

@ -19,7 +19,6 @@
#ifndef MYFPRINTF_H #ifndef MYFPRINTF_H
#define MYFPRINTF_H #define MYFPRINTF_H
#include "../config.h"
#include "gcc.h" #include "gcc.h"
#include "os_compat.h" #include "os_compat.h"

View File

@ -16,10 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "normalize.h"
#include "compress.h" #include "compress.h"
#include "conf.h" #include "conf.h"
#include "normalize.h"
#include "os_compat.h"
#define DEFAULT_VOLUME_NORMALIZATION 0 #define DEFAULT_VOLUME_NORMALIZATION 0

View File

@ -19,6 +19,8 @@
#ifndef OS_COMPAT_H #ifndef OS_COMPAT_H
#define OS_COMPAT_H #define OS_COMPAT_H
#include "../config.h"
/* /*
* This includes OS-wide headers that can be expected to be available * 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. * on any machine that mpd can be compiled on for any UNIX-like OS.

View File

@ -18,13 +18,8 @@
#include "outputBuffer.h" #include "outputBuffer.h"
#include "pcm_utils.h"
#include "playerData.h"
#include "utils.h" #include "utils.h"
#include "log.h"
#include "normalize.h" #include "normalize.h"
#include "conf.h"
#include "os_compat.h"
void initOutputBuffer(OutputBuffer * cb, unsigned int size) void initOutputBuffer(OutputBuffer * cb, unsigned int size)
{ {

View File

@ -22,7 +22,6 @@
#include "pcm_utils.h" #include "pcm_utils.h"
#include "mpd_types.h" #include "mpd_types.h"
#include "decode.h" #include "decode.h"
#include "audio.h"
#include "inputStream.h" #include "inputStream.h"
#include "replayGain.h" #include "replayGain.h"

View File

@ -19,7 +19,6 @@
#ifndef PATH_H #ifndef PATH_H
#define PATH_H #define PATH_H
#include "../config.h"
#include "os_compat.h" #include "os_compat.h"
#if !defined(MPD_PATH_MAX) #if !defined(MPD_PATH_MAX)

View File

@ -19,8 +19,6 @@
#ifndef PERMISSION_H #ifndef PERMISSION_H
#define PERMISSION_H #define PERMISSION_H
#include "../config.h"
#define PERMISSION_NONE 0 #define PERMISSION_NONE 0
#define PERMISSION_READ 1 #define PERMISSION_READ 1
#define PERMISSION_ADD 2 #define PERMISSION_ADD 2

View File

@ -30,7 +30,7 @@
#include "volume.h" #include "volume.h"
#include "playerData.h" #include "playerData.h"
#include "permission.h" #include "permission.h"
#include "sig_handlers.h" #include "ack.h"
#include "os_compat.h" #include "os_compat.h"
static void playerCloseAudio(void); static void playerCloseAudio(void);

View File

@ -19,8 +19,6 @@
#ifndef PLAYER_H #ifndef PLAYER_H
#define PLAYER_H #define PLAYER_H
#include "../config.h"
#include "decode.h" #include "decode.h"
#include "mpd_types.h" #include "mpd_types.h"
#include "song.h" #include "song.h"

View File

@ -20,7 +20,6 @@
#include "conf.h" #include "conf.h"
#include "log.h" #include "log.h"
#include "utils.h" #include "utils.h"
#include "os_compat.h"
unsigned int buffered_before_play; unsigned int buffered_before_play;

View File

@ -19,8 +19,6 @@
#ifndef PLAYER_DATA_H #ifndef PLAYER_DATA_H
#define PLAYER_DATA_H #define PLAYER_DATA_H
#include "../config.h"
#include "audio.h" #include "audio.h"
#include "player.h" #include "player.h"
#include "decode.h" #include "decode.h"

View File

@ -26,9 +26,10 @@
#include "log.h" #include "log.h"
#include "path.h" #include "path.h"
#include "utils.h" #include "utils.h"
#include "sig_handlers.h"
#include "state_file.h" #include "state_file.h"
#include "storedPlaylist.h" #include "storedPlaylist.h"
#include "ack.h"
#include "myfprintf.h"
#include "os_compat.h" #include "os_compat.h"
#define PLAYLIST_STATE_STOP 0 #define PLAYLIST_STATE_STOP 0

View File

@ -19,10 +19,7 @@
#ifndef PLAYLIST_H #ifndef PLAYLIST_H
#define PLAYLIST_H #define PLAYLIST_H
#include "../config.h"
#include "dbUtils.h" #include "dbUtils.h"
#include "os_compat.h"
#define PLAYLIST_FILE_SUFFIX "m3u" #define PLAYLIST_FILE_SUFFIX "m3u"
#define PLAYLIST_COMMENT '#' #define PLAYLIST_COMMENT '#'

View File

@ -18,8 +18,6 @@
*/ */
#include "sig_handlers.h" #include "sig_handlers.h"
#include "player.h"
#include "playerData.h"
#include "playlist.h" #include "playlist.h"
#include "directory.h" #include "directory.h"
#include "command.h" #include "command.h"
@ -27,7 +25,6 @@
#include "log.h" #include "log.h"
#include "player.h" #include "player.h"
#include "decode.h" #include "decode.h"
#include "os_compat.h"
int handlePendingSignals(void) int handlePendingSignals(void)
{ {

View File

@ -19,8 +19,6 @@
#ifndef SIG_HANDLERS_H #ifndef SIG_HANDLERS_H
#define SIG_HANDLERS_H #define SIG_HANDLERS_H
#include "../config.h"
int handlePendingSignals(void); int handlePendingSignals(void);
void initSigHandlers(void); void initSigHandlers(void);

View File

@ -20,8 +20,6 @@
#ifndef SIGNAL_CHECK_H #ifndef SIGNAL_CHECK_H
#define SIGNAL_CHECK_H #define SIGNAL_CHECK_H
#include "os_compat.h"
void signal_handle(int sig); void signal_handle(int sig);
void signal_unhandle(int sig); void signal_unhandle(int sig);
int signal_is_pending(int sig); int signal_is_pending(int sig);

View File

@ -18,7 +18,6 @@
/* a very simple singly-linked-list structure for queues/buffers */ /* a very simple singly-linked-list structure for queues/buffers */
#include "os_compat.h"
#include "sllist.h" #include "sllist.h"
#include "utils.h" #include "utils.h"

View File

@ -21,6 +21,8 @@
#ifndef SLLIST_H #ifndef SLLIST_H
#define SLLIST_H #define SLLIST_H
#include "os_compat.h"
/* just free the entire structure if it's free-able, the 'data' member /* just free the entire structure if it's free-able, the 'data' member
* should _NEVER_ be explicitly freed * should _NEVER_ be explicitly freed
* *

View File

@ -21,7 +21,6 @@
#include "directory.h" #include "directory.h"
#include "myfprintf.h" #include "myfprintf.h"
#include "player.h" #include "player.h"
#include "tag.h"
#include "tagTracker.h" #include "tagTracker.h"
#include "os_compat.h" #include "os_compat.h"

View File

@ -19,8 +19,6 @@
#ifndef STATS_H #ifndef STATS_H
#define STATS_H #define STATS_H
#include "../config.h"
typedef struct _Stats { typedef struct _Stats {
unsigned long daemonStart; unsigned long daemonStart;
int numberOfSongs; int numberOfSongs;

View File

@ -17,10 +17,8 @@
*/ */
#include "storedPlaylist.h" #include "storedPlaylist.h"
#include "log.h"
#include "path.h" #include "path.h"
#include "utils.h" #include "utils.h"
#include "playlist.h"
#include "ack.h" #include "ack.h"
#include "command.h" #include "command.h"
#include "ls.h" #include "ls.h"

View File

@ -22,7 +22,6 @@
#include "song.h" #include "song.h"
#include "list.h" #include "list.h"
#include "playlist.h" #include "playlist.h"
#include "path.h"
List *loadStoredPlaylist(int fd, const char *utf8path); List *loadStoredPlaylist(int fd, const char *utf8path);

View File

@ -17,17 +17,13 @@
*/ */
#include "tag.h" #include "tag.h"
#include "path.h"
#include "myfprintf.h" #include "myfprintf.h"
#include "utils.h" #include "utils.h"
#include "utf8.h" #include "utf8.h"
#include "log.h" #include "log.h"
#include "inputStream.h"
#include "conf.h" #include "conf.h"
#include "charConv.h" #include "charConv.h"
#include "tagTracker.h" #include "tagTracker.h"
#include "mpd_types.h"
#include "gcc.h"
#include "song.h" #include "song.h"
#include "os_compat.h" #include "os_compat.h"

View File

@ -18,11 +18,10 @@
#include "tagTracker.h" #include "tagTracker.h"
#include "tag.h"
#include "tree.h" #include "tree.h"
#include "log.h"
#include "utils.h" #include "utils.h"
#include "myfprintf.h" #include "myfprintf.h"
#include "os_compat.h"
static Tree *tagTrees[TAG_NUM_OF_ITEM_TYPES]; static Tree *tagTrees[TAG_NUM_OF_ITEM_TYPES];

View File

@ -19,8 +19,6 @@
#ifndef TAG_TRACKER_H #ifndef TAG_TRACKER_H
#define TAG_TRACKER_H #define TAG_TRACKER_H
#include "tag.h"
char *getTagItemString(int type, char *string); char *getTagItemString(int type, char *string);
void removeTagItemString(int type, char *string); void removeTagItemString(int type, char *string);

View File

@ -19,7 +19,8 @@
#include "utils.h" #include "utils.h"
#include "log.h" #include "log.h"
#include "conf.h" #include "conf.h"
#include "os_compat.h"
#include "../config.h"
char *myFgets(char *buffer, int bufferSize, FILE * fp) char *myFgets(char *buffer, int bufferSize, FILE * fp)
{ {

View File

@ -19,7 +19,6 @@
#ifndef UTILS_H #ifndef UTILS_H
#define UTILS_H #define UTILS_H
#include "../config.h"
#include "gcc.h" #include "gcc.h"
#include "os_compat.h" #include "os_compat.h"

View File

@ -21,11 +21,13 @@
#include "conf.h" #include "conf.h"
#include "log.h" #include "log.h"
#include "player.h" #include "player.h"
#include "state_file.h"
#include "gcc.h" #include "gcc.h"
#include "utils.h" #include "utils.h"
#include "ack.h"
#include "os_compat.h" #include "os_compat.h"
#include "../config.h"
#ifdef HAVE_OSS #ifdef HAVE_OSS
#include <sys/soundcard.h> #include <sys/soundcard.h>
#endif #endif

View File

@ -19,7 +19,6 @@
#ifndef VOLUME_H #ifndef VOLUME_H
#define VOLUME_H #define VOLUME_H
#include "../config.h"
#include "os_compat.h" #include "os_compat.h"
#define VOLUME_MIXER_OSS "oss" #define VOLUME_MIXER_OSS "oss"