From a5f8bb82300d08568180482c93e8b9a067cc715d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 5 Oct 2008 20:54:11 -0700 Subject: song: replace printSong* with song_print_* This make argument order more consistent for iterators. Additionally, these now return ssize_t results for error checking. --- src/song.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/song.h') diff --git a/src/song.h b/src/song.h index 377a78814..3419cd43e 100644 --- a/src/song.h +++ b/src/song.h @@ -46,13 +46,13 @@ void freeSong(Song *); void freeJustSong(Song *); -int printSongInfo(int fd, Song * song); +ssize_t song_print_info(Song * song, int fd); void readSongInfoIntoList(FILE * fp, struct _Directory *parent); int updateSongInfo(Song * song); -void printSongUrl(int fd, Song * song); +ssize_t song_print_url(Song * song, int fd); /* * get_song_url - Returns a path of a song in UTF8-encoded form -- cgit v1.2.3 From 9bda68824ebd1b87d5ab28802ab4c310bc9d148a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 6 Oct 2008 01:44:53 -0700 Subject: song: add print_song_info_x for iterators tha pass void * traverseAllIn will be modified to take < 0 as errors instead of non-zero... --- src/song.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/song.h') diff --git a/src/song.h b/src/song.h index 3419cd43e..e65f70f38 100644 --- a/src/song.h +++ b/src/song.h @@ -48,6 +48,9 @@ void freeJustSong(Song *); ssize_t song_print_info(Song * song, int fd); +/* like song_print_info, but casts data into an fd first */ +int song_print_info_x(Song * song, void *data); + void readSongInfoIntoList(FILE * fp, struct _Directory *parent); int updateSongInfo(Song * song); -- cgit v1.2.3 From a67facd051d817dd53bac1aebfc554b07420e8cd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 7 Oct 2008 02:06:01 -0700 Subject: song: Add song_print_url_x It'll be handy for passing throug songvec_for_each like song_print_info_x. --- src/song.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/song.h') diff --git a/src/song.h b/src/song.h index e65f70f38..d8189d42c 100644 --- a/src/song.h +++ b/src/song.h @@ -57,6 +57,9 @@ int updateSongInfo(Song * song); ssize_t song_print_url(Song * song, int fd); +/* like song_print_url_x, but casts data into an fd first */ +int song_print_url_x(Song * song, void *data); + /* * get_song_url - Returns a path of a song in UTF8-encoded form * path_max_tmp is the argument that the URL is written to, this -- cgit v1.2.3 From 19c6f1ee92cf6514e885def44f7deb9d225de4dc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 7 Oct 2008 02:57:59 -0700 Subject: directory: serialize song deletes from playlist during update This makes the update code thread-safe and doesn't penalize the playlist code by complicating it with complicated and error-prone locks (and the associated overhead, not everybody has a thread-implementation as good as NPTL). The update task blocks during the delete; but the update task is a slow task anyways so we can block w/o people caring too much. This was also our only freeSong call site, so remove that function. Note that deleting entire directories is not fully thread-safe, yet; as their traversals are not yet locked. --- src/song.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/song.h') diff --git a/src/song.h b/src/song.h index d8189d42c..9aa9efa94 100644 --- a/src/song.h +++ b/src/song.h @@ -42,8 +42,6 @@ typedef struct _Song { Song *newSong(const char *url, struct _Directory *parentDir); -void freeSong(Song *); - void freeJustSong(Song *); ssize_t song_print_info(Song * song, int fd); -- cgit v1.2.3