From 6e36de2724d1e19fa301400bc258489e7589006b Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 15 Dec 2016 13:13:47 +0000 Subject: trivial: Add some asserts to shut up clang --- libappstream-glib/as-store.c | 7 +++++++ libappstream-glib/as-yaml.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c index a5507c3..f7df0fe 100644 --- a/libappstream-glib/as-store.c +++ b/libappstream-glib/as-store.c @@ -1274,6 +1274,7 @@ as_store_match_addons (AsStore *store) /* profile */ ptask = as_profile_start_literal (priv->profile, "AsStore:match-addons"); + g_assert (ptask != NULL); for (i = 0; i < priv->array->len; i++) { AsApp *app = g_ptr_array_index (priv->array, i); if (as_app_get_kind (app) != AS_APP_KIND_ADDON) @@ -1344,6 +1345,7 @@ as_store_from_root (AsStore *store, /* profile */ ptask = as_profile_start_literal (priv->profile, "AsStore:store-from-root"); + g_assert (ptask != NULL); /* emit once when finished */ tok = as_store_changed_inhibit (store); @@ -1811,6 +1813,7 @@ as_store_from_file_internal (AsStore *store, ptask = as_profile_start (priv->profile, "AsStore:store-from-file{%s}", filename); + g_assert (ptask != NULL); /* a DEP-11 file */ if (g_strstr_len (filename, -1, ".yml") != NULL) { @@ -2665,6 +2668,7 @@ as_store_load_installed (AsStore *store, /* profile */ ptask = as_profile_start (priv->profile, "AsStore:load-installed{%s}", path); + g_assert (ptask != NULL); dir = g_dir_open (path, 0, error); if (dir == NULL) @@ -2837,6 +2841,7 @@ as_store_search_per_system (AsStore *store, /* profile */ ptask = as_profile_start_literal (priv->profile, "AsStore:load{per-system}"); + g_assert (ptask != NULL); /* datadir AppStream, AppData and desktop */ data_dirs = g_get_system_data_dirs (); @@ -2920,6 +2925,7 @@ as_store_search_per_user (AsStore *store, /* profile */ ptask = as_profile_start_literal (priv->profile, "AsStore:load{per-user}"); + g_assert (ptask != NULL); /* AppStream */ if ((flags & AS_STORE_LOAD_FLAG_APP_INFO_USER) > 0) { @@ -3028,6 +3034,7 @@ as_store_load (AsStore *store, /* profile */ ptask = as_profile_start_literal (priv->profile, "AsStore:load"); + g_assert (ptask != NULL); tok = as_store_changed_inhibit (store); /* per-user locations */ diff --git a/libappstream-glib/as-yaml.c b/libappstream-glib/as-yaml.c index 579695a..5e4dccd 100644 --- a/libappstream-glib/as-yaml.c +++ b/libappstream-glib/as-yaml.c @@ -448,6 +448,7 @@ as_yaml_from_data (const gchar *data, return NULL; } parser_cleanup = &parser; + g_assert (parser_cleanup != NULL); if (data_len < 0) data_len = (gssize) strlen (data); yaml_parser_set_input_string (&parser, (guchar *) data, (gsize) data_len); @@ -536,6 +537,7 @@ as_yaml_from_file (GFile *file, AsYamlFromFlags flags, GCancellable *cancellable return NULL; } parser_cleanup = &parser; + g_assert (parser_cleanup != NULL); yaml_parser_set_input (&parser, as_yaml_read_handler_cb, stream_data); node = g_node_new (NULL); ctx.parser = &parser; -- cgit v1.2.1