From 57b17b7e6585fc9dfdaee10e31441e39354a4422 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 6 Sep 2008 15:28:31 +0200 Subject: dbUtils, playlist, directory: pass constant pointers The usual bunch of const pointer conversions. --- src/directory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/directory.h') diff --git a/src/directory.h b/src/directory.h index acb173fc0..00b902510 100644 --- a/src/directory.h +++ b/src/directory.h @@ -60,11 +60,11 @@ int readDirectoryDB(void); void updateMp3Directory(void); -Song *getSongFromDB(char *file); +Song *getSongFromDB(const char *file); time_t getDbModTime(void); -int traverseAllIn(int fd, char *name, +int traverseAllIn(int fd, const char *name, int (*forEachSong) (int, Song *, void *), int (*forEachDir) (int, Directory *, void *), void *data); -- cgit v1.2.3 From dcc575a3a877e342e895df9fc99108028151cc6a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 7 Sep 2008 13:48:24 +0200 Subject: 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. --- src/directory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/directory.h') diff --git a/src/directory.h b/src/directory.h index 00b902510..02a6b22d4 100644 --- a/src/directory.h +++ b/src/directory.h @@ -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 : "") -- cgit v1.2.3 From 7d7b69e576500522a011627d7937e255aa7c16c7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 7 Sep 2008 13:48:37 +0200 Subject: directory: don't pass fd to traverseAllIn() This patch continues the work of the previous patch: don't pass a file descriptor at all to traverseAllIn(). Since this fd was only used to report "directory not found" errors, we can easily move that check to the caller. This is a great relief, since it removes the dependency on a client connection from a lot of enumeration functions. --- src/directory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/directory.h') diff --git a/src/directory.h b/src/directory.h index 02a6b22d4..19dada309 100644 --- a/src/directory.h +++ b/src/directory.h @@ -64,7 +64,7 @@ Song *getSongFromDB(const char *file); time_t getDbModTime(void); -int traverseAllIn(int fd, const char *name, +int traverseAllIn(const char *name, int (*forEachSong) (Song *, void *), int (*forEachDir) (Directory *, void *), void *data); -- cgit v1.2.3