aboutsummaryrefslogtreecommitdiffstats
path: root/src/dirvec.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* {dir,song}vec: remove unused *_destroy routinesEric Wong2008-10-131-11/+0
| | | | | | | Blindly destroying these without freeing the underlying elements was a bad idea, always. Our iterators suck less nowadays and we can traverse them and free() each element safely.
* {dir,song}vec: fix off-by-one errors in {dir,song}vec_deleteEric Wong2008-10-121-8/+9
| | | | | | | Found by Valgrind while looking for another bug... Hmm.. I should really just make this code generic since they're duplicated...
* {dir,song}vec: these structs are constEric Wong2008-10-121-1/+1
| | | | We definitely don't modify them here.
* update: fix multiple deletes from *vec iteratorsEric Wong2008-10-121-1/+5
| | | | | | | | | | | {song,dir}vec_for_each each failed to gracefully handle deleted files when iterating through. While we were thread-safe, we were not safe within the calling thread. If a callback we passed caused sv->nr to shring, our index would still increment; causing files to stay in the database. A way to test this is to remove 10 or so contiguous songs from a >10 song directory.
* directory: always maintain sorted properties vectorsEric Wong2008-10-121-9/+6
| | | | | | | | | This allows clients to see sorted results while we're updating the DB and removes the need for us to have to sort manually. We'll have to write separate routines for managing stored playlists with songvecs eventually; but that's for another day.
* dirvec: introduce locking for all iteratorsEric Wong2008-10-121-7/+29
| | | | | | | Like the songvec nr_lock, only one lock is used for all traversals since they're rarely changed. This only projects traversals, but not the individual structures themselves.
* dirvec: add dirvec_for_each iteratorEric Wong2008-10-121-0/+16
| | | | This will make it easier to introduce locking
* dirvec: constant pointers in dirvec_find()Max Kellermann2008-10-111-1/+1
| | | | | dirvec_find() does not modify the object, thus it should get a const pointer.
* directory: eliminate CamelCaseMax Kellermann2008-10-111-1/+1
| | | | | | | | CamelCase is ugly, rename the functions. [ew: "directory_get_directory" was too confusing, using "directory_get_subdir" instead (old function was named "getSubDirectory")]
* directory: converted typedef Directory to struct directoryMax Kellermann2008-10-111-8/+9
| | | | | The struct can be forward-declared by other headers, which relaxes the header dependencies.
* dirvec: moved code to dirvec.cMax Kellermann2008-10-111-0/+69
Having all functions as static (non-inline) functions generates GCC warnings, and duplicates binary code across several object files. Most of dirvec's methods are too complex for becoming inline functions. Move them all to dirvec.c and publish the prototypes in dirvec.h.