[gnome-photos/wip/rishi/collection: 8/42] item-manager: Avoid a goto
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 8/42] item-manager: Avoid a goto
- Date: Wed, 31 Jan 2018 19:00:22 +0000 (UTC)
commit 4c507c34a5cf5150b4833ce5e9289b8462d1b389
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Jan 24 12:27:53 2018 +0100
item-manager: Avoid a goto
The current structure of the code was driven by the lack of
g_auto*-like RAII.
src/photos-item-manager.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index f6166200..10fc1fa3 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -1065,24 +1065,23 @@ photos_item_manager_create_item (PhotosItemManager *self, TrackerSparqlCursor *c
g_return_val_if_fail (TRACKER_SPARQL_IS_CURSOR (cursor), NULL);
identifier = g_strdup (tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_IDENTIFIER, NULL));
- if (identifier == NULL)
- goto final;
-
- split_identifier = g_strsplit (identifier, ":", 4);
-
- if (photos_item_manager_cursor_is_collection (cursor))
- {
- /* Its a collection. */
- extension_name = split_identifier[2];
- }
- else
+ if (identifier != NULL)
{
- /* Its a normal photo item. */
- if (g_strv_length (split_identifier) > 1)
- extension_name = split_identifier[0];
+ split_identifier = g_strsplit (identifier, ":", 4);
+
+ if (photos_item_manager_cursor_is_collection (cursor))
+ {
+ /* Its a collection. */
+ extension_name = split_identifier[2];
+ }
+ else
+ {
+ /* Its a normal photo item. */
+ if (g_strv_length (split_identifier) > 1)
+ extension_name = split_identifier[0];
+ }
}
- final:
extension = g_io_extension_point_get_extension_by_name (self->extension_point, extension_name);
if (G_UNLIKELY (extension == NULL))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]