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
This commit is contained in:
Max Kellermann 2008-03-26 10:37:36 +00:00 committed by Eric Wong
parent 54b544c2f4
commit c5b524e376
9 changed files with 20 additions and 24 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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 *));

View File

@ -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;

View File

@ -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));

View File

@ -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,

View File

@ -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;

View File

@ -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)