From cda840683be98e3d94b73de91d02d379c7e117d4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 26 Nov 2017 00:02:28 +0100 Subject: [PATCH] playlist.c - some optimizations --- playlist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/playlist.c b/playlist.c index 9c840dd250..2c22d9243d 100644 --- a/playlist.c +++ b/playlist.c @@ -381,22 +381,23 @@ void playlist_write_file(playlist_t *playlist) { size_t i; RFILE *file = NULL; + FILE *fp = NULL; if (!playlist || !playlist->modified) return; file = filestream_open(playlist->conf_path, RFILE_MODE_WRITE, -1); - RARCH_LOG("Trying to write to playlist file: %s\n", playlist->conf_path); - if (!file) { RARCH_ERR("Failed to write to playlist file: %s\n", playlist->conf_path); return; } + fp = filestream_get_fp(file); + for (i = 0; i < playlist->size; i++) - fprintf(filestream_get_fp(file), "%s\n%s\n%s\n%s\n%s\n%s\n", + fprintf(fp, "%s\n%s\n%s\n%s\n%s\n%s\n", playlist->entries[i].path ? playlist->entries[i].path : "", playlist->entries[i].label ? playlist->entries[i].label : "", playlist->entries[i].core_path, @@ -406,6 +407,9 @@ void playlist_write_file(playlist_t *playlist) ); playlist->modified = false; + + RARCH_LOG("Written to playlist file: %s\n", playlist->conf_path); + filestream_close(file); }