From 79e8abb461fa848cce3717333ee5cfa55ee91c71 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Oct 2008 10:49:11 +0200 Subject: song: converted typedef Song to struct song Again, a data type which can be forward-declared. [ew: * used "struct mpd_song" instead to avoid token duplication (like I did with "struct mpd_tag") as there's no good abbreviation for "song" and identical tokens on the same line don't read well * rewritten using perl -i -p -e 's/\bSong\b/struct mpd_song/g' src/*.[ch] since it was too hard to merge * also, I don't care much for forward declarations ] --- src/song.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/song.c') diff --git a/src/song.c b/src/song.c index f8a949578..be84bfa4b 100644 --- a/src/song.c +++ b/src/song.c @@ -29,10 +29,10 @@ #include "os_compat.h" -static Song * song_alloc(const char *url, struct directory *parent) +static struct mpd_song * song_alloc(const char *url, struct directory *parent) { size_t urllen; - Song *song; + struct mpd_song *song; assert(url); urllen = strlen(url); @@ -46,9 +46,9 @@ static Song * song_alloc(const char *url, struct directory *parent) return song; } -Song *newSong(const char *url, struct directory *parentDir) +struct mpd_song *newSong(const char *url, struct directory *parentDir) { - Song *song; + struct mpd_song *song; assert(*url); if (strchr(url, '\n')) { @@ -79,14 +79,14 @@ Song *newSong(const char *url, struct directory *parentDir) return song; } -void freeJustSong(Song * song) +void freeJustSong(struct mpd_song * song) { if (song->tag) tag_free(song->tag); free(song); } -ssize_t song_print_url(Song *song, int fd) +ssize_t song_print_url(struct mpd_song *song, int fd) { if (song->parentDir && song->parentDir->path) return fdprintf(fd, "%s%s/%s\n", SONG_FILE, @@ -94,7 +94,7 @@ ssize_t song_print_url(Song *song, int fd) return fdprintf(fd, "%s%s\n", SONG_FILE, song->url); } -ssize_t song_print_info(Song *song, int fd) +ssize_t song_print_info(struct mpd_song *song, int fd) { ssize_t ret = song_print_url(song, fd); @@ -106,19 +106,19 @@ ssize_t song_print_info(Song *song, int fd) return ret; } -int song_print_info_x(Song * song, void *data) +int song_print_info_x(struct mpd_song * song, void *data) { return song_print_info(song, (int)(size_t)data); } -int song_print_url_x(Song * song, void *data) +int song_print_url_x(struct mpd_song * song, void *data) { return song_print_url(song, (int)(size_t)data); } -static void insertSongIntoList(struct songvec *sv, Song *newsong) +static void insertSongIntoList(struct songvec *sv, struct mpd_song *newsong) { - Song *existing = songvec_find(sv, newsong->url); + struct mpd_song *existing = songvec_find(sv, newsong->url); if (!existing) { songvec_add(sv, newsong); @@ -164,7 +164,7 @@ void readSongInfoIntoList(FILE * fp, struct directory * parentDir) { char buffer[MPD_PATH_MAX + 1024]; int bufferSize = MPD_PATH_MAX + 1024; - Song *song = NULL; + struct mpd_song *song = NULL; struct songvec *sv = &parentDir->songs; int itemType; @@ -207,7 +207,7 @@ void readSongInfoIntoList(FILE * fp, struct directory * parentDir) insertSongIntoList(sv, song); } -int updateSongInfo(Song * song) +int updateSongInfo(struct mpd_song * song) { if (song_is_file(song)) { InputPlugin *plugin; @@ -238,7 +238,7 @@ int updateSongInfo(Song * song) return 0; } -char *get_song_url(char *path_max_tmp, Song *song) +char *get_song_url(char *path_max_tmp, struct mpd_song *song) { if (!song) return NULL; -- cgit v1.2.3