summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-03-26 10:37:36 +0000
committerEric Wong <normalperson@yhbt.net>2008-03-26 10:37:36 +0000
commitc5b524e3762723a200156b79efd58192db320e5b (patch)
tree9dac5dabb515cfab1b68afc88739bc3937b3f26d /src
parent54b544c2f4c0b5425d6ff12596a9e82fd8d783d2 (diff)
eliminated duplicate initialization
Local variables which are never read before the first assignment don't need initialization. Saves a few bytes of text. Also don't reset variables which are never read until function return. git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/audioOutputs/audioOutput_oss.c6
-rw-r--r--src/audioOutputs/audioOutput_shout.c2
-rw-r--r--src/command.c4
-rw-r--r--src/dbUtils.c2
-rw-r--r--src/inputPlugins/oggvorbis_plugin.c4
-rw-r--r--src/ls.c2
-rw-r--r--src/playlist.c4
-rw-r--r--src/song.c10
-rw-r--r--src/tag.c10
9 files changed, 20 insertions, 24 deletions
diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c
index 1051869f5..093b1a2ca 100644
--- a/src/audioOutputs/audioOutput_oss.c
+++ b/src/audioOutputs/audioOutput_oss.c
@@ -168,7 +168,7 @@ static void addUnsupportedParam(OssData * od, int param, int val)
static void removeSupportedParam(OssData * od, int param, int val)
{
- int i = 0;
+ int i;
int j = 0;
int idx = getIndexForParam(param);
@@ -185,7 +185,7 @@ static void removeSupportedParam(OssData * od, int param, int val)
static void removeUnsupportedParam(OssData * od, int param, int val)
{
- int i = 0;
+ int i;
int j = 0;
int idx = getIndexForParam(param);
@@ -481,7 +481,7 @@ fail:
static int oss_openDevice(AudioOutput * audioOutput)
{
- int ret = -1;
+ int ret;
OssData *od = audioOutput->data;
AudioFormat *audioFormat = &audioOutput->outAudioFormat;
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index 87a35e9b2..d2725ffac 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -292,7 +292,7 @@ static int myShout_handleError(ShoutData * sd, int err)
static int write_page(ShoutData * sd)
{
- int err = 0;
+ int err;
shout_sync(sd->shoutConn);
err = shout_send(sd->shoutConn, sd->og.header, sd->og.header_len);
diff --git a/src/command.c b/src/command.c
index 78eb9a597..661c28fdd 100644
--- a/src/command.c
+++ b/src/command.c
@@ -747,7 +747,7 @@ static int handleClearError(int fd, int *permission, int argc, char *argv[])
static int handleList(int fd, int *permission, int argc, char *argv[])
{
- int numConditionals = 0;
+ int numConditionals;
LocateTagItem *conditionals = NULL;
int tagType = getLocateTagItemType(argv[1]);
int ret;
@@ -1122,7 +1122,7 @@ static CommandEntry *getCommandEntryAndCheckArgcAndPermission(int fd,
static CommandEntry *getCommandEntryFromString(char *string, int *permission)
{
- CommandEntry *cmd = NULL;
+ CommandEntry *cmd;
char *argv[COMMAND_ARGV_MAX] = { NULL };
int argc = buffer2array(string, argv, COMMAND_ARGV_MAX);
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 32dbe3b6c..11f724b21 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -81,7 +81,7 @@ static int searchInDirectory(int fd, Song * song, void *data)
int searchForSongsIn(int fd, char *name, int numItems, LocateTagItem * items)
{
- int ret = -1;
+ int ret;
int i;
char **originalNeedles = xmalloc(numItems * sizeof(char *));
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c
index 3bcc505f8..ec1c44ac6 100644
--- a/src/inputPlugins/oggvorbis_plugin.c
+++ b/src/inputPlugins/oggvorbis_plugin.c
@@ -61,7 +61,7 @@ typedef struct _OggCallbackData {
static size_t ogg_read_cb(void *ptr, size_t size, size_t nmemb, void *vdata)
{
- size_t ret = 0;
+ size_t ret;
OggCallbackData *data = (OggCallbackData *) vdata;
while (1) {
@@ -352,7 +352,7 @@ static int oggvorbis_decode(OutputBuffer * cb, DecoderControl * dc,
static MpdTag *oggvorbis_TagDup(char *file)
{
- MpdTag *ret = NULL;
+ MpdTag *ret;
FILE *fp;
OggVorbis_File vf;
diff --git a/src/ls.c b/src/ls.c
index a858057c3..53e4c330d 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -108,7 +108,7 @@ int lsPlaylists(int fd, const char *utf8path)
char s[MPD_PATH_MAX];
char path_max_tmp[MPD_PATH_MAX];
List *list = NULL;
- ListNode *node = NULL;
+ ListNode *node;
char *actualPath = rpp2app_r(path_max_tmp,
utf8_to_fs_charset(path_max_tmp,
utf8path));
diff --git a/src/playlist.c b/src/playlist.c
index 81c3ee687..60ad75627 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -87,7 +87,7 @@ static void incrPlaylistVersion(void)
void playlistVersionChange(void)
{
- int i = 0;
+ int i;
for (i = 0; i < playlist.length; i++) {
playlist.songMod[i] = playlist.version;
@@ -664,7 +664,7 @@ int addSongToPlaylist(int fd, Song * song, int *added_id)
int swapSongsInPlaylist(int fd, int song1, int song2)
{
int queuedSong = -1;
- int currentSong = -1;
+ int currentSong;
if (song1 < 0 || song1 >= playlist.length) {
commandError(fd, ACK_ERROR_NO_EXIST,
diff --git a/src/song.c b/src/song.c
index 83781efb8..aece9d8e8 100644
--- a/src/song.c
+++ b/src/song.c
@@ -46,7 +46,7 @@ Song *newNullSong(void)
Song *newSong(const char *url, int type, Directory * parentDir)
{
- Song *song = NULL;
+ Song *song;
if (strchr(url, '\n')) {
DEBUG("newSong: '%s' is not a valid uri\n", url);
@@ -239,11 +239,9 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir)
while (myFgets(buffer, bufferSize, fp) && 0 != strcmp(SONG_END, buffer)) {
if (0 == strncmp(SONG_KEY, buffer, strlen(SONG_KEY))) {
- if (song) {
+ if (song)
insertSongIntoList(list, &nextSongNode,
song->url, song);
- song = NULL;
- }
song = newNullSong();
song->url = xstrdup(buffer + strlen(SONG_KEY));
@@ -274,10 +272,8 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir)
FATAL("songinfo: unknown line in db: %s\n", buffer);
}
- if (song) {
+ if (song)
insertSongIntoList(list, &nextSongNode, song->url, song);
- song = NULL;
- }
while (nextSongNode) {
nodeTemp = nextSongNode->nextNode;
diff --git a/src/tag.c b/src/tag.c
index cfda3add1..b3645e007 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -137,7 +137,7 @@ void printMpdTag(int fd, MpdTag * tag)
*/
static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4, int type)
{
- id3_utf8_t *utf8 = NULL;
+ id3_utf8_t *utf8;
id3_latin1_t *isostr;
char *encoding;
@@ -174,7 +174,7 @@ static MpdTag *getID3Info(
{
struct id3_frame const *frame;
id3_ucs4_t const *ucs4;
- id3_utf8_t *utf8 = NULL;
+ id3_utf8_t *utf8;
union id3_field const *field;
unsigned int nstrings;
int i;
@@ -462,7 +462,7 @@ MpdTag *id3Dup(char *file)
MpdTag *apeDup(char *file)
{
MpdTag *ret = NULL;
- FILE *fp = NULL;
+ FILE *fp;
int tagCount;
char *buffer = NULL;
char *p;
@@ -613,7 +613,7 @@ static void deleteItem(MpdTag * tag, int idx)
void clearItemsFromMpdTag(MpdTag * tag, int type)
{
- int i = 0;
+ int i;
for (i = 0; i < tag->numOfItems; i++) {
if (tag->items[i].type == type) {
@@ -650,7 +650,7 @@ void freeMpdTag(MpdTag * tag)
MpdTag *mpdTagDup(MpdTag * tag)
{
- MpdTag *ret = NULL;
+ MpdTag *ret;
int i;
if (!tag)