aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-07-25 12:16:15 +0200
committerMax Kellermann <max@duempel.org>2010-07-25 12:43:54 +0200
commit0c5305c51f9a20efa229cbf825d3d03241887122 (patch)
tree0cb6c1dbe09831f1fa7605e47328e0351d8ceb94
parent63c9a20f96dff970cfbc76f2eebc6162abd056f6 (diff)
downloadmpd-0c5305c51f9a20efa229cbf825d3d03241887122.tar.gz
mpd-0c5305c51f9a20efa229cbf825d3d03241887122.tar.xz
mpd-0c5305c51f9a20efa229cbf825d3d03241887122.zip
queue_save: move code to queue_save_song()
-rw-r--r--src/queue_save.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/queue_save.c b/src/queue_save.c
index 69ef483b3..16561537d 100644
--- a/src/queue_save.c
+++ b/src/queue_save.c
@@ -26,16 +26,20 @@
#include <stdlib.h>
+static void
+queue_save_song(FILE *fp, int idx, const struct song *song)
+{
+ char *uri = song_get_uri(song);
+
+ fprintf(fp, "%i:%s\n", idx, uri);
+ g_free(uri);
+}
+
void
queue_save(FILE *fp, const struct queue *queue)
{
- for (unsigned i = 0; i < queue_length(queue); i++) {
- const struct song *song = queue_get(queue, i);
- char *uri = song_get_uri(song);
-
- fprintf(fp, "%i:%s\n", i, uri);
- g_free(uri);
- }
+ for (unsigned i = 0; i < queue_length(queue); i++)
+ queue_save_song(fp, i, queue_get(queue, i));
}
static struct song *