diff --git a/src/mpdclient.c b/src/mpdclient.c
index 9a9154caafb4f57de45d462dc7db54218a140af2..1c21785e2054807c6876bac310906f313663a064 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
/*** Filelist functions *****************************************************/
/****************************************************************************/
+static struct filelist *
+mpdclient_recv_filelist_response(struct mpdclient *c);
+
struct filelist *
mpdclient_filelist_get(struct mpdclient *c, const gchar *path)
{
struct filelist *filelist;
- struct mpd_entity *entity;
if (MPD_ERROR(c))
return NULL;
mpd_send_list_meta(c->connection, path);
- filelist = filelist_new();
-
- while ((entity = mpd_recv_entity(c->connection)) != NULL)
- filelist_append(filelist, entity);
-
- if (!mpdclient_finish_command(c)) {
- filelist_free(filelist);
+ filelist = mpdclient_recv_filelist_response(c);
+ if (filelist == NULL)
return NULL;
- }
filelist_sort_dir_play(filelist, compare_filelistentry);
mpdclient_recv_filelist_response(struct mpdclient *c)
{
struct filelist *filelist;
- struct mpd_entity *entity;
-
- filelist = filelist_new();
- while ((entity = mpd_recv_entity(c->connection)) != NULL)
- filelist_append(filelist, entity);
+ filelist = filelist_new_recv(c->connection);
if (!mpdclient_finish_command(c)) {
filelist_free(filelist);