aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-18 15:40:50 +0100
committerMax Kellermann <max@duempel.org>2009-01-18 15:40:50 +0100
commit14ca99b22469808642034813156281a203cfee5e (patch)
treee6a38e78d4fe52eb915198c04a8d1fd75ea8577c /src/dbUtils.c
parent91fb2a29deaafcc0ae9c710aec3c5cf54ce60d91 (diff)
downloadmpd-14ca99b22469808642034813156281a203cfee5e.tar.gz
mpd-14ca99b22469808642034813156281a203cfee5e.tar.xz
mpd-14ca99b22469808642034813156281a203cfee5e.zip
stats: use one db_walk() to obtain stats
Don't use dbUtils.h functions. This reduces 4 full database walks to just one.
Diffstat (limited to 'src/dbUtils.c')
-rw-r--r--src/dbUtils.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 3677b2ae6..cd1476d9d 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -51,16 +51,6 @@ typedef struct _SearchStats {
} SearchStats;
static int
-countSongsInDirectory(struct directory *directory, void *data)
-{
- int *count = (int *)data;
-
- *count += directory->songs.nr;
-
- return 0;
-}
-
-static int
printDirectoryInDirectory(struct directory *directory, void *data)
{
struct client *client = data;
@@ -237,43 +227,12 @@ directoryPrintSongInfo(struct song *song, void *data)
return 0;
}
-static int
-sumSongTime(struct song *song, void *data)
-{
- unsigned long *sum_time = (unsigned long *)data;
-
- if (song->tag && song->tag->time >= 0)
- *sum_time += song->tag->time;
-
- return 0;
-}
-
int printInfoForAllIn(struct client *client, const char *name)
{
return db_walk(name, directoryPrintSongInfo,
printDirectoryInDirectory, client);
}
-int countSongsIn(const char *name)
-{
- int count = 0;
- void *ptr = (void *)&count;
-
- db_walk(name, NULL, countSongsInDirectory, ptr);
-
- return count;
-}
-
-unsigned long sumSongTimesIn(const char *name)
-{
- unsigned long dbPlayTime = 0;
- void *ptr = (void *)&dbPlayTime;
-
- db_walk(name, sumSongTime, NULL, ptr);
-
- return dbPlayTime;
-}
-
static ListCommandItem *newListCommandItem(int tagType, int numConditionals,
LocateTagItem * conditionals)
{