From 59506d45e7fea2bd94fa147834e5ce85e5681372 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 27 Feb 2018 08:25:40 -0500 Subject: [PATCH] core/file: Rename cache_file_import() -> file_import() Signed-off-by: Anna Schumaker --- core/file.c | 6 +++--- core/tags/album.c | 2 +- include/core/file.h | 2 +- tests/core/file.c | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/file.c b/core/file.c index 81e51d3c..a67d2979 100644 --- a/core/file.c +++ b/core/file.c @@ -246,17 +246,17 @@ int file_write(struct file *file, const void *data, size_t len) return -1; } -bool cache_file_import(struct file *cache, const gchar *srcpath) +bool file_import(struct file *file, const gchar *srcpath) { gchar *contents = NULL; gsize length = 0; - if (!cache->f_file || !srcpath) + if (!file->f_file || !srcpath) return false; if (!g_file_get_contents(srcpath, &contents, &length, NULL)) return false; - file_write(cache, contents, length); + file_write(file, contents, length); return true; } diff --git a/core/tags/album.c b/core/tags/album.c index bac7096b..f8bce5d0 100644 --- a/core/tags/album.c +++ b/core/tags/album.c @@ -392,7 +392,7 @@ bool album_artwork_import(struct album *album, gchar *path) file = __album_alloc_file(album); if (path && file_open(&file->ac_file, OPEN_WRITE_BINARY)) { - ret = cache_file_import(&file->ac_file, path); + ret = file_import(&file->ac_file, path); file_close(&file->ac_file); } __album_free_file(file); diff --git a/include/core/file.h b/include/core/file.h index f8c3b362..53dcfb4b 100644 --- a/include/core/file.h +++ b/include/core/file.h @@ -144,7 +144,7 @@ gchar *file_read(struct file *); int file_write(struct file *, const void *, size_t); /* Import a file into the cache. */ -bool cache_file_import(struct file *, const gchar *); +bool file_import(struct file *, const gchar *); /* Removes a closed file from disk. */ bool file_remove(struct file *); diff --git a/tests/core/file.c b/tests/core/file.c index 55115e32..cf9747d2 100644 --- a/tests/core/file.c +++ b/tests/core/file.c @@ -215,11 +215,11 @@ static void test_cache() /* Test importing a file into the cache. */ g_assert_false(file_exists(©)); - g_assert_false(cache_file_import(©, filepath)); + g_assert_false(file_import(©, filepath)); g_assert_false(file_exists(©)); - g_assert_true(file_open(©, OPEN_WRITE_BINARY)); - g_assert_false(cache_file_import(©, NULL)); - g_assert_true(cache_file_import(©, filepath)); + g_assert_true( file_open(©, OPEN_WRITE_BINARY)); + g_assert_false(file_import(©, NULL)); + g_assert_true( file_import(©, filepath)); g_assert_false(file_exists(©)); file_close(©); g_assert_true(file_exists(©));