From f7d150a360be0730a0eeaf6ff5e787508e8ede0d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 8 Aug 2006 02:23:21 +0000 Subject: more sparse cleanups * less-commonly compiled things like ao/mvp outputs * Adding -Wno-transparent-union to SPARSE_FLAGS makes it check inside decode.c, directory.c, player.c, and sig_handlers.c * remove unused variables leftover from the master process in sig_handlers.c git-svn-id: https://svn.musicpd.org/mpd/trunk@4598 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/audioOutputs/audioOutput_ao.c | 4 ++-- src/audioOutputs/audioOutput_mvp.c | 2 +- src/decode.c | 2 +- src/directory.c | 24 ++++++++++---------- src/player.c | 46 +++++++++++++++++++------------------- src/sig_handlers.c | 17 ++++++-------- 6 files changed, 46 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/audioOutputs/audioOutput_ao.c b/src/audioOutputs/audioOutput_ao.c index c5f6c209c..e94a6e6b7 100644 --- a/src/audioOutputs/audioOutput_ao.c +++ b/src/audioOutputs/audioOutput_ao.c @@ -38,7 +38,7 @@ typedef struct _AoData { ao_device *device; } AoData; -static AoData *newAoData() +static AoData *newAoData(void) { AoData *ret = malloc(sizeof(AoData)); ret->device = NULL; @@ -47,7 +47,7 @@ static AoData *newAoData() return ret; } -static void audioOutputAo_error() +static void audioOutputAo_error(void) { if (errno == AO_ENOTLIVE) { ERROR("not a live ao device\n"); diff --git a/src/audioOutputs/audioOutput_mvp.c b/src/audioOutputs/audioOutput_mvp.c index b4d5a5d5b..b82b0a5b7 100644 --- a/src/audioOutputs/audioOutput_mvp.c +++ b/src/audioOutputs/audioOutput_mvp.c @@ -90,7 +90,7 @@ static int pcmfrequencies[][3] = { static int numfrequencies = sizeof(pcmfrequencies) / 12; -static int mvp_testDefault() +static int mvp_testDefault(void) { int fd; diff --git a/src/decode.c b/src/decode.c index 4a23d55ed..c07da9907 100644 --- a/src/decode.c +++ b/src/decode.c @@ -680,7 +680,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) * child process does decoding * parent process does playing audio */ -void decode() +void decode(void) { OutputBuffer *cb; PlayerControl *pc; diff --git a/src/directory.c b/src/directory.c index 73a43d98f..51702d4b0 100644 --- a/src/directory.c +++ b/src/directory.c @@ -103,7 +103,7 @@ static int inodeFoundInParent(Directory * parent, ino_t inode, dev_t device); static int statDirectory(Directory * dir); -static char *getDbFile() +static char *getDbFile(void) { ConfigParam *param = parseConfigFilePath(CONF_DB_FILE, 1); @@ -113,12 +113,12 @@ static char *getDbFile() return param->value; } -static void clearUpdatePid() +static void clearUpdatePid(void) { directory_updatePid = 0; } -int isUpdatingDB() +int isUpdatingDB(void) { if (directory_updatePid > 0 || directory_reReadDB) { return directory_updateJobId; @@ -150,7 +150,7 @@ void directory_sigChldHandler(int pid, int status) } } -void readDirectoryDBIfUpdateIsFinished() +void readDirectoryDBIfUpdateIsFinished(void) { if (directory_reReadDB && 0 == directory_updatePid) { DEBUG("readDirectoryDB since update finished successfully\n"); @@ -279,7 +279,7 @@ static void freeDirectory(Directory * directory) /*getDirectoryPath(NULL); */ } -static DirectoryList *newDirectoryList() +static DirectoryList *newDirectoryList(void) { return makeList((ListFreeDataFunc *) freeDirectory, 1); } @@ -809,7 +809,7 @@ static int addToDirectory(Directory * directory, char *shortname, char *name) return -1; } -void closeMp3Directory() +void closeMp3Directory(void) { freeDirectory(mp3rootDirectory); } @@ -1020,7 +1020,7 @@ static void sortDirectory(Directory * directory) } } -int checkDirectoryDB() +int checkDirectoryDB(void) { struct stat st; char *dbFile; @@ -1087,7 +1087,7 @@ int checkDirectoryDB() return 0; } -int writeDirectoryDB() +int writeDirectoryDB(void) { FILE *fp; char *dbFile = getDbFile(); @@ -1121,7 +1121,7 @@ int writeDirectoryDB() return 0; } -int readDirectoryDB() +int readDirectoryDB(void) { FILE *fp = NULL; char *dbFile = getDbFile(); @@ -1218,7 +1218,7 @@ int readDirectoryDB() return 0; } -void updateMp3Directory() +void updateMp3Directory(void) { switch (updateDirectory(mp3rootDirectory)) { case 0: @@ -1309,7 +1309,7 @@ static void freeAllDirectoryStats(Directory * directory) freeDirectoryStatFromDirectory(directory); } -void initMp3Directory() +void initMp3Directory(void) { struct stat st; @@ -1371,7 +1371,7 @@ Song *getSongFromDB(char *file) return getSongDetails(file, NULL, NULL); } -time_t getDbModTime() +time_t getDbModTime(void) { return directory_dbModTime; } diff --git a/src/player.c b/src/player.c index 17ec780ed..faa05a32a 100644 --- a/src/player.c +++ b/src/player.c @@ -46,12 +46,12 @@ volatile int player_pid = 0; -void clearPlayerPid() +void clearPlayerPid(void) { player_pid = 0; } -static void resetPlayerMetadata() +static void resetPlayerMetadata(void) { PlayerControl *pc = &(getPlayerData()->playerControl); @@ -60,7 +60,7 @@ static void resetPlayerMetadata() } } -void resetPlayer() +void resetPlayer(void) { int pid; @@ -108,7 +108,7 @@ void player_sigChldHandler(int pid, int status) } } -int playerInit() +int playerInit(void) { blockSignals(); player_pid = fork(); @@ -217,7 +217,7 @@ int playerStop(int fd) return 0; } -void playerKill() +void playerKill(void) { int pid; /*PlayerControl * pc = &(getPlayerData()->playerControl); @@ -265,37 +265,37 @@ int playerSetPause(int fd, int pause) return 0; } -int getPlayerElapsedTime() +int getPlayerElapsedTime(void) { return (int)(getPlayerData()->playerControl.elapsedTime + 0.5); } -unsigned long getPlayerBitRate() +unsigned long getPlayerBitRate(void) { return getPlayerData()->playerControl.bitRate; } -int getPlayerTotalTime() +int getPlayerTotalTime(void) { return (int)(getPlayerData()->playerControl.totalTime + 0.5); } -int getPlayerState() +int getPlayerState(void) { return getPlayerData()->playerControl.state; } -void clearPlayerError() +void clearPlayerError(void) { getPlayerData()->playerControl.error = 0; } -int getPlayerError() +int getPlayerError(void) { return getPlayerData()->playerControl.error; } -char *getPlayerErrorStr() +char *getPlayerErrorStr(void) { static char *error = NULL; int errorlen = MAXPATHLEN + 1024; @@ -336,7 +336,7 @@ char *getPlayerErrorStr() return NULL; } -void playerCloseAudio() +void playerCloseAudio(void) { PlayerControl *pc = &(getPlayerData()->playerControl); @@ -368,7 +368,7 @@ int queueSong(Song * song) return -1; } -int getPlayerQueueState() +int getPlayerQueueState(void) { PlayerControl *pc = &(getPlayerData()->playerControl); @@ -382,7 +382,7 @@ void setQueueState(int queueState) pc->queueState = queueState; } -void playerQueueLock() +void playerQueueLock(void) { PlayerControl *pc = &(getPlayerData()->playerControl); @@ -393,7 +393,7 @@ void playerQueueLock() } } -void playerQueueUnlock() +void playerQueueUnlock(void) { PlayerControl *pc = &(getPlayerData()->playerControl); @@ -436,7 +436,7 @@ int playerSeek(int fd, Song * song, float time) return 0; } -float getPlayerCrossFade() +float getPlayerCrossFade(void) { PlayerControl *pc = &(getPlayerData()->playerControl); @@ -464,35 +464,35 @@ void setPlayerSoftwareVolume(int volume) pc->softwareVolume = volume; } -double getPlayerTotalPlayTime() +double getPlayerTotalPlayTime(void) { PlayerControl *pc = &(getPlayerData()->playerControl); return pc->totalPlayTime; } -unsigned int getPlayerSampleRate() +unsigned int getPlayerSampleRate(void) { PlayerControl *pc = &(getPlayerData()->playerControl); return pc->sampleRate; } -int getPlayerBits() +int getPlayerBits(void) { PlayerControl *pc = &(getPlayerData()->playerControl); return pc->bits; } -int getPlayerChannels() +int getPlayerChannels(void) { PlayerControl *pc = &(getPlayerData()->playerControl); return pc->channels; } -void playerCycleLogFiles() +void playerCycleLogFiles(void) { PlayerControl *pc = &(getPlayerData()->playerControl); DecoderControl *dc = &(getPlayerData()->decoderControl); @@ -502,7 +502,7 @@ void playerCycleLogFiles() } /* this actually creates a dupe of the current metadata */ -Song *playerCurrentDecodeSong() +Song *playerCurrentDecodeSong(void) { static Song *song = NULL; static MetadataChunk *prev = NULL; diff --git a/src/sig_handlers.c b/src/sig_handlers.c index 2c6a07a00..15ca0829c 100644 --- a/src/sig_handlers.c +++ b/src/sig_handlers.c @@ -36,10 +36,7 @@ #include #include -extern volatile int masterPid; -extern volatile int mainPid; - -int handlePendingSignals() +int handlePendingSignals(void) { if (signal_is_pending(SIGINT) || signal_is_pending(SIGTERM)) { DEBUG("main process got SIGINT or SIGTERM, exiting\n"); @@ -78,7 +75,7 @@ void chldSigHandler(int signal) } } -void initSigHandlers() +void initSigHandlers(void) { struct sigaction sa; @@ -94,7 +91,7 @@ void initSigHandlers() signal_handle(SIGHUP); } -void finishSigHandlers() +void finishSigHandlers(void) { signal_unhandle(SIGINT); signal_unhandle(SIGUSR1); @@ -102,7 +99,7 @@ void finishSigHandlers() signal_unhandle(SIGHUP); } -void setSigHandlersForDecoder() +void setSigHandlersForDecoder(void) { struct sigaction sa; @@ -119,7 +116,7 @@ void setSigHandlersForDecoder() while (sigaction(SIGTERM, &sa, NULL) < 0 && errno == EINTR) ; } -void ignoreSignals() +void ignoreSignals(void) { struct sigaction sa; @@ -135,7 +132,7 @@ void ignoreSignals() while (sigaction(SIGHUP, &sa, NULL) < 0 && errno == EINTR) ; } -void blockSignals() +void blockSignals(void) { sigset_t sset; @@ -148,7 +145,7 @@ void blockSignals() while (sigprocmask(SIG_BLOCK, &sset, NULL) < 0 && errno == EINTR) ; } -void unblockSignals() +void unblockSignals(void) { sigset_t sset; -- cgit v1.2.3