[libmediaart/remove-mediaartlocal-rebased-on-async-api: 3/3] cache: Fix checks for output variables
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libmediaart/remove-mediaartlocal-rebased-on-async-api: 3/3] cache: Fix checks for output variables
- Date: Fri, 17 Oct 2014 10:21:40 +0000 (UTC)
commit b6bb110bbcb7a787c3ef238ffb972c705a2c64c2
Author: Martyn Russell <martyn lanedo com>
Date: Fri Oct 17 11:16:50 2014 +0100
cache: Fix checks for output variables
libmediaart/cache.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/libmediaart/cache.c b/libmediaart/cache.c
index ecbc7a1..fb737e8 100644
--- a/libmediaart/cache.c
+++ b/libmediaart/cache.c
@@ -284,16 +284,14 @@ media_art_get_file (const gchar *artist,
/* http://live.gnome.org/MediaArtStorageSpec */
- if (cache_file) {
- *cache_file = NULL;
- }
-
/* Rules:
* 1. artist OR title must be non-NULL.
* 2. cache_file must be non-NULL
*/
g_return_val_if_fail (artist != NULL || title != NULL, FALSE);
- g_return_val_if_fail (!G_IS_FILE (cache_file), FALSE);
+ g_return_val_if_fail (cache_file != NULL, FALSE);
+
+ *cache_file = NULL;
if (artist) {
artist_stripped = media_art_strip_invalid_entities (artist);
@@ -341,11 +339,9 @@ media_art_get_file (const gchar *artist,
g_free (title_norm);
}
- if (cache_file) {
- filename = g_build_filename (dir, art_filename, NULL);
- *cache_file = g_file_new_for_path (filename);
- g_free (filename);
- }
+ filename = g_build_filename (dir, art_filename, NULL);
+ *cache_file = g_file_new_for_path (filename);
+ g_free (filename);
g_free (dir);
g_free (art_filename);
@@ -380,6 +376,7 @@ media_art_get_path (const gchar *artist,
gchar **cache_path)
{
GFile *cache_file = NULL;
+ gboolean success;
/* Rules:
* 1. artist OR title must be non-NULL.
@@ -388,12 +385,10 @@ media_art_get_path (const gchar *artist,
g_return_val_if_fail (artist != NULL || title != NULL, FALSE);
g_return_val_if_fail (cache_path != NULL, FALSE);
- media_art_get_file (artist, title, prefix, cache_path ? &cache_file : NULL);
- if (cache_path) {
- *cache_path = cache_file ? g_file_get_path (cache_file) : NULL;
- }
+ success = media_art_get_file (artist, title, prefix, &cache_file);
+ *cache_path = cache_file ? g_file_get_path (cache_file) : NULL;
- return TRUE;
+ return success;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]