directory: don't pass fd to traverseAllIn() callbacks
Database traversal should be generic, and not bound to a client connection. This is the first step: no file descriptor for the callback functions forEachSong() and forEachDir(). If a callback needs the file descriptor, it has to be passed in the void*data pointer somehow; some callbacks might need a new struct for passing more than one parameter. This might look a bit cumbersome right now, but our goal is to have a clean API.
This commit is contained in:
@@ -65,8 +65,8 @@ Song *getSongFromDB(const char *file);
|
||||
time_t getDbModTime(void);
|
||||
|
||||
int traverseAllIn(int fd, const char *name,
|
||||
int (*forEachSong) (int, Song *, void *),
|
||||
int (*forEachDir) (int, Directory *, void *), void *data);
|
||||
int (*forEachSong) (Song *, void *),
|
||||
int (*forEachDir) (Directory *, void *), void *data);
|
||||
|
||||
#define getDirectoryPath(dir) ((dir && dir->path) ? dir->path : "")
|
||||
|
||||
|
Reference in New Issue
Block a user