[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: Thu, 25 Jan 2018 03:16:34 +0000 (UTC)
commit b5beeded2222a8b995f2618c155e5921b120e496
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 46c0db10..a3041a4e 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -1071,24 +1071,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]