aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-05 23:12:33 +0200
committerMax Kellermann <max@duempel.org>2011-09-05 23:14:39 +0200
commitdadf1339b57d76057b7a66dce7d3b7b2f7d796f6 (patch)
tree6bc90138b2cac507d730c6fab8d7e07e10b8359e
parentc2c4228722d0f73ceeda844b09c0bb04c88a6f83 (diff)
downloadmpd-dadf1339b57d76057b7a66dce7d3b7b2f7d796f6.tar.gz
mpd-dadf1339b57d76057b7a66dce7d3b7b2f7d796f6.tar.xz
mpd-dadf1339b57d76057b7a66dce7d3b7b2f7d796f6.zip
dbUtils: pass player_control to findAddIn()
Allow calling findAddIn() without a client object.
-rw-r--r--src/command.c2
-rw-r--r--src/dbUtils.c19
-rw-r--r--src/dbUtils.h2
3 files changed, 14 insertions, 9 deletions
diff --git a/src/command.c b/src/command.c
index 3e60e0ac3..dfa3688e0 100644
--- a/src/command.c
+++ b/src/command.c
@@ -956,7 +956,7 @@ handle_findadd(struct client *client, int argc, char *argv[])
return COMMAND_RETURN_ERROR;
}
- ret = findAddIn(client, NULL, list);
+ ret = findAddIn(client->player_control, NULL, list);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST,
"directory or file not found");
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 9a44b314b..6ef1f6aa9 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -203,25 +203,30 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file)
return db_walk(name, directoryAddSongToStoredPlaylist, NULL, &data);
}
+struct find_add_data {
+ struct player_control *pc;
+ const struct locate_item_list *criteria;
+};
+
static int
findAddInDirectory(struct song *song, void *_data)
{
- struct search_data *data = _data;
+ struct find_add_data *data = _data;
if (locate_song_match(song, data->criteria))
return playlist_append_song(&g_playlist,
- data->client->player_control,
+ data->pc,
song, NULL);
return 0;
}
-int findAddIn(struct client *client, const char *name,
- const struct locate_item_list *criteria)
+int
+findAddIn(struct player_control *pc, const char *name,
+ const struct locate_item_list *criteria)
{
- struct search_data data;
-
- data.client = client;
+ struct find_add_data data;
+ data.pc = pc;
data.criteria = criteria;
return db_walk(name, findAddInDirectory, NULL, &data);
diff --git a/src/dbUtils.h b/src/dbUtils.h
index 5de8af5c9..96ea2095d 100644
--- a/src/dbUtils.h
+++ b/src/dbUtils.h
@@ -42,7 +42,7 @@ findSongsIn(struct client *client, const char *name,
const struct locate_item_list *criteria);
int
-findAddIn(struct client *client, const char *name,
+findAddIn(struct player_control *pc, const char *name,
const struct locate_item_list *criteria);
int