[gnome-photos] utils: Consolidate the return and assert a post-condition
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] utils: Consolidate the return and assert a post-condition
- Date: Wed, 13 Dec 2017 14:58:48 +0000 (UTC)
commit 726887766dac44efcbbde4c3ec8616530fa58acc
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Dec 13 14:11:42 2017 +0100
utils: Consolidate the return and assert a post-condition
src/photos-utils.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-utils.c b/src/photos-utils.c
index 64a58ff..82a2b7e 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -116,14 +116,19 @@ gchar *
photos_utils_convert_path_to_uri (const gchar *path)
{
g_autoptr (GFile) file = NULL;
- gchar *uri;
+ gchar *uri = NULL;
if (path == NULL)
- return g_strdup ("");
+ {
+ uri = g_strdup ("");
+ goto out;
+ }
file = g_file_new_for_path (path);
uri = g_file_get_uri (file);
+ out:
+ g_return_val_if_fail (uri != NULL, NULL);
return uri;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]