From c5b524e3762723a200156b79efd58192db320e5b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Mar 2008 10:37:36 +0000 Subject: 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 --- src/song.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/song.c') 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; -- cgit v1.2.3