aboutsummaryrefslogtreecommitdiffstats
path: root/src/songvec.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* songvec: pass const pointersMax Kellermann2008-10-111-1/+1
| | | | | | Pass const songvec pointers to songvec_find() and songvec_for_each(). [ew: already merged songvec_for_each() cosntification somewhere...]
* directory: moved code to database.cMax Kellermann2008-10-111-1/+2
| | | | | | Taming the directory.c monster, part II: move the database management stuff to database. directory.c should only contain code which works on directory objects.
* song: converted typedef Song to struct songMax Kellermann2008-10-111-11/+11
| | | | | | | | | | | | | | | 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 ]
* directory: use songvec_for_each for iteratorsEric Wong2008-10-071-31/+0
| | | | Get rid of songvec_write so we can enforce proper locking
* songvec: lock traversals for thread-safe updates/readsEric Wong2008-10-071-10/+34
| | | | | | | | | | Only one lock is used for all songvec traversals since they're rarely changed. Also, minimize lock time and release it before calling iterator functions since they may block (updateSongInfo => stat/open/seek/read). This lock only protects songvecs (and all of them) during traversals; not the individual song structures themselves.
* songvec: add songvec_for_each iteratorEric Wong2008-10-051-0/+13
| | | | | This is so we can more consistently deal with locking needed for thread-safety in iterator functions.
* song: replace printSong* with song_print_*Eric Wong2008-10-051-2/+2
| | | | | | This make argument order more consistent for iterators. Additionally, these now return ssize_t results for error checking.
* songvec: songvec_delete takes a const Song pointerEric Wong2008-09-281-1/+1
| | | | We don't modify the Song when we delete it
* songvec_free => songvec_destroyEric Wong2008-09-281-1/+1
| | | | | "free" implies the songvec structure itself is freed, which is not the case.
* songvec: avoid free(NULL)Eric Wong2008-09-231-2/+4
| | | | Potentially broken free() implementations don't like it
* songvec: remove songvec_pruneEric Wong2008-09-221-23/+0
| | | | | | Any pruned files will be noticed during update and pruned from the live database, so this inefficient function can go away and never come back.
* Replace SongList with struct songvecEric Wong2008-09-201-0/+121
Our linked-list implementation is wasteful and the SongList isn't modified enough to benefit from being a linked list. So use a more compact array of song pointers which saves ~200K on a library with ~9K songs (on x86-32).