queue_save: move code to queue_save_song()

This commit is contained in:
Max Kellermann 2010-07-25 12:16:15 +02:00
parent 63c9a20f96
commit 0c5305c51f

View File

@ -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 *