[gnome-software/gnome-3-16] 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-16] trivial: Don't use 'goto out' pattern for plugin initialization
- Date: Sat, 6 Jun 2015 21:34:05 +0000 (UTC)
commit 4189a3981e4a9d0186bd5e9e2a88107c6da5cdb7
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 d3b0c4d..785d2cb 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -734,7 +734,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");
@@ -780,7 +780,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 */
@@ -914,7 +914,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 */
@@ -953,7 +953,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 */
@@ -1039,7 +1039,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 */
@@ -1053,7 +1053,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;
}
@@ -1305,7 +1304,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]