Commit 0c5305c5 authored by Max Kellermann's avatar Max Kellermann

queue_save: move code to queue_save_song()

parent 63c9a20f
......@@ -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 *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment