song: get rid of newNullSong()
It didn't save us any lines of code nor did it do anything useful since we would overwrite everything anyways.
This commit is contained in:
parent
dc245f389c
commit
43761441c9
15
src/song.c
15
src/song.c
@ -28,17 +28,6 @@
|
|||||||
|
|
||||||
#include "os_compat.h"
|
#include "os_compat.h"
|
||||||
|
|
||||||
Song *newNullSong(void)
|
|
||||||
{
|
|
||||||
Song *song = xmalloc(sizeof(Song));
|
|
||||||
|
|
||||||
song->tag = NULL;
|
|
||||||
song->url = NULL;
|
|
||||||
song->type = SONG_TYPE_FILE;
|
|
||||||
song->parentDir = NULL;
|
|
||||||
|
|
||||||
return song;
|
|
||||||
}
|
|
||||||
|
|
||||||
Song *newSong(const char *url, enum song_type type, Directory * parentDir)
|
Song *newSong(const char *url, enum song_type type, Directory * parentDir)
|
||||||
{
|
{
|
||||||
@ -49,8 +38,8 @@ Song *newSong(const char *url, enum song_type type, Directory * parentDir)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
song = newNullSong();
|
song = xmalloc(sizeof(*song));
|
||||||
|
song->tag = NULL;
|
||||||
song->url = xstrdup(url);
|
song->url = xstrdup(url);
|
||||||
song->type = type;
|
song->type = type;
|
||||||
song->parentDir = parentDir;
|
song->parentDir = parentDir;
|
||||||
|
@ -42,8 +42,6 @@ typedef struct _Song {
|
|||||||
time_t mtime;
|
time_t mtime;
|
||||||
} Song;
|
} Song;
|
||||||
|
|
||||||
Song *newNullSong(void);
|
|
||||||
|
|
||||||
Song *newSong(const char *url, enum song_type type,
|
Song *newSong(const char *url, enum song_type type,
|
||||||
struct _Directory *parentDir);
|
struct _Directory *parentDir);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
|
|||||||
if (song)
|
if (song)
|
||||||
insertSongIntoList(sv, song);
|
insertSongIntoList(sv, song);
|
||||||
|
|
||||||
song = newNullSong();
|
song = xmalloc(sizeof(*song));
|
||||||
song->url = xstrdup(buffer + strlen(SONG_KEY));
|
song->url = xstrdup(buffer + strlen(SONG_KEY));
|
||||||
song->type = SONG_TYPE_FILE;
|
song->type = SONG_TYPE_FILE;
|
||||||
song->parentDir = parentDir;
|
song->parentDir = parentDir;
|
||||||
|
Loading…
Reference in New Issue
Block a user