[gnome-software/gnome-3-14] trivial: Don't use 'goto out' pattern for plugin initialization
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-14] trivial: Don't use 'goto out' pattern for plugin initialization
- Date: Sat, 6 Jun 2015 22:00:17 +0000 (UTC)
commit f8613ea7dc18088d3d892e3ae3c9e469c46fcb3f
Author: Kalev Lember <kalevlember gmail com>
Date: Sat Jun 6 20:53:56 2015 +0200
trivial: Don't use 'goto out' pattern for plugin initialization
Return immediately if the appstream plugin initialization fails to make
sure we don't do gs_profile_stop() in the out label without having done
a matching gs_profile_start() before.
This also paves way for the next commit where g_mutex_lock()/unlock()
have to match in a similar manner.
src/plugins/gs-plugin-appstream.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index b4f3714..22fbc82 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -918,7 +918,7 @@ gs_plugin_refine (GsPlugin *plugin,
ret = gs_plugin_startup (plugin, error);
g_once_init_leave (&plugin->priv->done_init, TRUE);
if (!ret)
- goto out;
+ return FALSE;
}
gs_profile_start (plugin->profile, "appstream::refine");
@@ -965,7 +965,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
ret = gs_plugin_startup (plugin, error);
g_once_init_leave (&plugin->priv->done_init, TRUE);
if (!ret)
- goto out;
+ return FALSE;
}
/* get the two search terms */
@@ -1102,7 +1102,7 @@ gs_plugin_add_search (GsPlugin *plugin,
ret = gs_plugin_startup (plugin, error);
g_once_init_leave (&plugin->priv->done_init, TRUE);
if (!ret)
- goto out;
+ return FALSE;
}
/* search categories for the search term */
@@ -1142,7 +1142,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
ret = gs_plugin_startup (plugin, error);
g_once_init_leave (&plugin->priv->done_init, TRUE);
if (!ret)
- goto out;
+ return FALSE;
}
/* search categories for the search term */
@@ -1229,7 +1229,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
ret = gs_plugin_startup (plugin, error);
g_once_init_leave (&plugin->priv->done_init, TRUE);
if (!ret)
- goto out;
+ return FALSE;
}
/* find out how many packages are in each category */
@@ -1243,7 +1243,6 @@ gs_plugin_add_categories (GsPlugin *plugin,
continue;
gs_plugin_add_categories_for_app (*list, app);
}
-out:
gs_profile_stop (plugin->profile, "appstream::add-categories");
return ret;
}
@@ -1504,7 +1503,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
ret = gs_plugin_startup (plugin, error);
g_once_init_leave (&plugin->priv->done_init, TRUE);
if (!ret)
- goto out;
+ return FALSE;
}
gs_profile_start (plugin->profile, "appstream::add_popular");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]