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
This commit is contained in:
Eric Wong 2006-08-08 02:23:21 +00:00
parent 6395edab69
commit f7d150a360
6 changed files with 46 additions and 49 deletions

View File

@ -38,7 +38,7 @@ typedef struct _AoData {
ao_device *device; ao_device *device;
} AoData; } AoData;
static AoData *newAoData() static AoData *newAoData(void)
{ {
AoData *ret = malloc(sizeof(AoData)); AoData *ret = malloc(sizeof(AoData));
ret->device = NULL; ret->device = NULL;
@ -47,7 +47,7 @@ static AoData *newAoData()
return ret; return ret;
} }
static void audioOutputAo_error() static void audioOutputAo_error(void)
{ {
if (errno == AO_ENOTLIVE) { if (errno == AO_ENOTLIVE) {
ERROR("not a live ao device\n"); ERROR("not a live ao device\n");

View File

@ -90,7 +90,7 @@ static int pcmfrequencies[][3] = {
static int numfrequencies = sizeof(pcmfrequencies) / 12; static int numfrequencies = sizeof(pcmfrequencies) / 12;
static int mvp_testDefault() static int mvp_testDefault(void)
{ {
int fd; int fd;

View File

@ -680,7 +680,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb)
* child process does decoding * child process does decoding
* parent process does playing audio * parent process does playing audio
*/ */
void decode() void decode(void)
{ {
OutputBuffer *cb; OutputBuffer *cb;
PlayerControl *pc; PlayerControl *pc;

View File

@ -103,7 +103,7 @@ static int inodeFoundInParent(Directory * parent, ino_t inode, dev_t device);
static int statDirectory(Directory * dir); static int statDirectory(Directory * dir);
static char *getDbFile() static char *getDbFile(void)
{ {
ConfigParam *param = parseConfigFilePath(CONF_DB_FILE, 1); ConfigParam *param = parseConfigFilePath(CONF_DB_FILE, 1);
@ -113,12 +113,12 @@ static char *getDbFile()
return param->value; return param->value;
} }
static void clearUpdatePid() static void clearUpdatePid(void)
{ {
directory_updatePid = 0; directory_updatePid = 0;
} }
int isUpdatingDB() int isUpdatingDB(void)
{ {
if (directory_updatePid > 0 || directory_reReadDB) { if (directory_updatePid > 0 || directory_reReadDB) {
return directory_updateJobId; 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) { if (directory_reReadDB && 0 == directory_updatePid) {
DEBUG("readDirectoryDB since update finished successfully\n"); DEBUG("readDirectoryDB since update finished successfully\n");
@ -279,7 +279,7 @@ static void freeDirectory(Directory * directory)
/*getDirectoryPath(NULL); */ /*getDirectoryPath(NULL); */
} }
static DirectoryList *newDirectoryList() static DirectoryList *newDirectoryList(void)
{ {
return makeList((ListFreeDataFunc *) freeDirectory, 1); return makeList((ListFreeDataFunc *) freeDirectory, 1);
} }
@ -809,7 +809,7 @@ static int addToDirectory(Directory * directory, char *shortname, char *name)
return -1; return -1;
} }
void closeMp3Directory() void closeMp3Directory(void)
{ {
freeDirectory(mp3rootDirectory); freeDirectory(mp3rootDirectory);
} }
@ -1020,7 +1020,7 @@ static void sortDirectory(Directory * directory)
} }
} }
int checkDirectoryDB() int checkDirectoryDB(void)
{ {
struct stat st; struct stat st;
char *dbFile; char *dbFile;
@ -1087,7 +1087,7 @@ int checkDirectoryDB()
return 0; return 0;
} }
int writeDirectoryDB() int writeDirectoryDB(void)
{ {
FILE *fp; FILE *fp;
char *dbFile = getDbFile(); char *dbFile = getDbFile();
@ -1121,7 +1121,7 @@ int writeDirectoryDB()
return 0; return 0;
} }
int readDirectoryDB() int readDirectoryDB(void)
{ {
FILE *fp = NULL; FILE *fp = NULL;
char *dbFile = getDbFile(); char *dbFile = getDbFile();
@ -1218,7 +1218,7 @@ int readDirectoryDB()
return 0; return 0;
} }
void updateMp3Directory() void updateMp3Directory(void)
{ {
switch (updateDirectory(mp3rootDirectory)) { switch (updateDirectory(mp3rootDirectory)) {
case 0: case 0:
@ -1309,7 +1309,7 @@ static void freeAllDirectoryStats(Directory * directory)
freeDirectoryStatFromDirectory(directory); freeDirectoryStatFromDirectory(directory);
} }
void initMp3Directory() void initMp3Directory(void)
{ {
struct stat st; struct stat st;
@ -1371,7 +1371,7 @@ Song *getSongFromDB(char *file)
return getSongDetails(file, NULL, NULL); return getSongDetails(file, NULL, NULL);
} }
time_t getDbModTime() time_t getDbModTime(void)
{ {
return directory_dbModTime; return directory_dbModTime;
} }

View File

@ -46,12 +46,12 @@
volatile int player_pid = 0; volatile int player_pid = 0;
void clearPlayerPid() void clearPlayerPid(void)
{ {
player_pid = 0; player_pid = 0;
} }
static void resetPlayerMetadata() static void resetPlayerMetadata(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
@ -60,7 +60,7 @@ static void resetPlayerMetadata()
} }
} }
void resetPlayer() void resetPlayer(void)
{ {
int pid; int pid;
@ -108,7 +108,7 @@ void player_sigChldHandler(int pid, int status)
} }
} }
int playerInit() int playerInit(void)
{ {
blockSignals(); blockSignals();
player_pid = fork(); player_pid = fork();
@ -217,7 +217,7 @@ int playerStop(int fd)
return 0; return 0;
} }
void playerKill() void playerKill(void)
{ {
int pid; int pid;
/*PlayerControl * pc = &(getPlayerData()->playerControl); /*PlayerControl * pc = &(getPlayerData()->playerControl);
@ -265,37 +265,37 @@ int playerSetPause(int fd, int pause)
return 0; return 0;
} }
int getPlayerElapsedTime() int getPlayerElapsedTime(void)
{ {
return (int)(getPlayerData()->playerControl.elapsedTime + 0.5); return (int)(getPlayerData()->playerControl.elapsedTime + 0.5);
} }
unsigned long getPlayerBitRate() unsigned long getPlayerBitRate(void)
{ {
return getPlayerData()->playerControl.bitRate; return getPlayerData()->playerControl.bitRate;
} }
int getPlayerTotalTime() int getPlayerTotalTime(void)
{ {
return (int)(getPlayerData()->playerControl.totalTime + 0.5); return (int)(getPlayerData()->playerControl.totalTime + 0.5);
} }
int getPlayerState() int getPlayerState(void)
{ {
return getPlayerData()->playerControl.state; return getPlayerData()->playerControl.state;
} }
void clearPlayerError() void clearPlayerError(void)
{ {
getPlayerData()->playerControl.error = 0; getPlayerData()->playerControl.error = 0;
} }
int getPlayerError() int getPlayerError(void)
{ {
return getPlayerData()->playerControl.error; return getPlayerData()->playerControl.error;
} }
char *getPlayerErrorStr() char *getPlayerErrorStr(void)
{ {
static char *error = NULL; static char *error = NULL;
int errorlen = MAXPATHLEN + 1024; int errorlen = MAXPATHLEN + 1024;
@ -336,7 +336,7 @@ char *getPlayerErrorStr()
return NULL; return NULL;
} }
void playerCloseAudio() void playerCloseAudio(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
@ -368,7 +368,7 @@ int queueSong(Song * song)
return -1; return -1;
} }
int getPlayerQueueState() int getPlayerQueueState(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
@ -382,7 +382,7 @@ void setQueueState(int queueState)
pc->queueState = queueState; pc->queueState = queueState;
} }
void playerQueueLock() void playerQueueLock(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
@ -393,7 +393,7 @@ void playerQueueLock()
} }
} }
void playerQueueUnlock() void playerQueueUnlock(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
@ -436,7 +436,7 @@ int playerSeek(int fd, Song * song, float time)
return 0; return 0;
} }
float getPlayerCrossFade() float getPlayerCrossFade(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
@ -464,35 +464,35 @@ void setPlayerSoftwareVolume(int volume)
pc->softwareVolume = volume; pc->softwareVolume = volume;
} }
double getPlayerTotalPlayTime() double getPlayerTotalPlayTime(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
return pc->totalPlayTime; return pc->totalPlayTime;
} }
unsigned int getPlayerSampleRate() unsigned int getPlayerSampleRate(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
return pc->sampleRate; return pc->sampleRate;
} }
int getPlayerBits() int getPlayerBits(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
return pc->bits; return pc->bits;
} }
int getPlayerChannels() int getPlayerChannels(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
return pc->channels; return pc->channels;
} }
void playerCycleLogFiles() void playerCycleLogFiles(void)
{ {
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
DecoderControl *dc = &(getPlayerData()->decoderControl); DecoderControl *dc = &(getPlayerData()->decoderControl);
@ -502,7 +502,7 @@ void playerCycleLogFiles()
} }
/* this actually creates a dupe of the current metadata */ /* this actually creates a dupe of the current metadata */
Song *playerCurrentDecodeSong() Song *playerCurrentDecodeSong(void)
{ {
static Song *song = NULL; static Song *song = NULL;
static MetadataChunk *prev = NULL; static MetadataChunk *prev = NULL;

View File

@ -36,10 +36,7 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
extern volatile int masterPid; int handlePendingSignals(void)
extern volatile int mainPid;
int handlePendingSignals()
{ {
if (signal_is_pending(SIGINT) || signal_is_pending(SIGTERM)) { if (signal_is_pending(SIGINT) || signal_is_pending(SIGTERM)) {
DEBUG("main process got SIGINT or SIGTERM, exiting\n"); 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; struct sigaction sa;
@ -94,7 +91,7 @@ void initSigHandlers()
signal_handle(SIGHUP); signal_handle(SIGHUP);
} }
void finishSigHandlers() void finishSigHandlers(void)
{ {
signal_unhandle(SIGINT); signal_unhandle(SIGINT);
signal_unhandle(SIGUSR1); signal_unhandle(SIGUSR1);
@ -102,7 +99,7 @@ void finishSigHandlers()
signal_unhandle(SIGHUP); signal_unhandle(SIGHUP);
} }
void setSigHandlersForDecoder() void setSigHandlersForDecoder(void)
{ {
struct sigaction sa; struct sigaction sa;
@ -119,7 +116,7 @@ void setSigHandlersForDecoder()
while (sigaction(SIGTERM, &sa, NULL) < 0 && errno == EINTR) ; while (sigaction(SIGTERM, &sa, NULL) < 0 && errno == EINTR) ;
} }
void ignoreSignals() void ignoreSignals(void)
{ {
struct sigaction sa; struct sigaction sa;
@ -135,7 +132,7 @@ void ignoreSignals()
while (sigaction(SIGHUP, &sa, NULL) < 0 && errno == EINTR) ; while (sigaction(SIGHUP, &sa, NULL) < 0 && errno == EINTR) ;
} }
void blockSignals() void blockSignals(void)
{ {
sigset_t sset; sigset_t sset;
@ -148,7 +145,7 @@ void blockSignals()
while (sigprocmask(SIG_BLOCK, &sset, NULL) < 0 && errno == EINTR) ; while (sigprocmask(SIG_BLOCK, &sset, NULL) < 0 && errno == EINTR) ;
} }
void unblockSignals() void unblockSignals(void)
{ {
sigset_t sset; sigset_t sset;