diff options
author | Max Kellermann <max@duempel.org> | 2008-09-16 19:11:39 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-16 19:11:39 +0200 |
commit | a6858acfdead6285a010a31b1fc7c8a730e91788 (patch) | |
tree | 3b698b3b2cdfedf680f5ee51f3802f82030ae23a /src/mpdclient.c | |
parent | eee102e5ddd2c400d707bffe21d9c6ec74507371 (diff) | |
download | mpd-a6858acfdead6285a010a31b1fc7c8a730e91788.tar.gz mpd-a6858acfdead6285a010a31b1fc7c8a730e91788.tar.xz mpd-a6858acfdead6285a010a31b1fc7c8a730e91788.zip |
mpdclient: added mpdclient_playlist_init(), mpdclient_playlist_clear()
Moved code from mpdclient_new() and mpdclient_playlist_free(). In
mpdclient_disconnect(), call mpdclient_playlist_clear() instead of
mpdclient_playlist_free() (which is now called in mpdclient_free()).
Diffstat (limited to 'src/mpdclient.c')
-rw-r--r-- | src/mpdclient.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mpdclient.c b/src/mpdclient.c index 1d52aebdb..8449ca42b 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -163,7 +163,7 @@ mpdclient_new(void) mpdclient_t *c; c = g_malloc0(sizeof(mpdclient_t)); - c->playlist.list = g_array_sized_new(FALSE, FALSE, sizeof(struct mpd_song *), 1024); + playlist_init(&c->playlist); return c; } @@ -172,6 +172,9 @@ mpdclient_t * mpdclient_free(mpdclient_t *c) { mpdclient_disconnect(c); + + mpdclient_playlist_free(&c->playlist); + g_list_free(c->error_callbacks); g_list_free(c->playlist_callbacks); g_list_free(c->browse_callbacks); @@ -191,8 +194,7 @@ mpdclient_disconnect(mpdclient_t *c) mpd_freeStatus(c->status); c->status = NULL; - if (c->playlist.list) - mpdclient_playlist_free(&c->playlist); + playlist_clear(&c->playlist); if (c->song) c->song = NULL; |