diff options
author | Richard Hughes <richard@hughsie.com> | 2014-06-04 09:17:11 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-06-04 09:17:19 +0100 |
commit | c7421b696dd3fa56aa9c5ce85e5c3eb3991c59d3 (patch) | |
tree | ef775a9bba91bc909127b287da8e2d2a1d5b3347 /libappstream-glib | |
parent | 262fd898f66e26ae19f44995eade1bd64b7c3604 (diff) | |
download | appstream-glib-c7421b696dd3fa56aa9c5ce85e5c3eb3991c59d3.tar.gz |
trivial: Use systemd-style cleanup functions
There's no point creating yet another format...
Diffstat (limited to 'libappstream-glib')
-rw-r--r-- | libappstream-glib/as-app-validate.c | 14 | ||||
-rw-r--r-- | libappstream-glib/as-app.c | 34 | ||||
-rw-r--r-- | libappstream-glib/as-cleanup.h | 36 | ||||
-rw-r--r-- | libappstream-glib/as-image.c | 10 | ||||
-rw-r--r-- | libappstream-glib/as-node.c | 34 | ||||
-rw-r--r-- | libappstream-glib/as-release.c | 4 | ||||
-rw-r--r-- | libappstream-glib/as-screenshot.c | 6 | ||||
-rw-r--r-- | libappstream-glib/as-self-test.c | 84 | ||||
-rw-r--r-- | libappstream-glib/as-store.c | 62 | ||||
-rw-r--r-- | libappstream-glib/as-utils.c | 18 |
10 files changed, 151 insertions, 151 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c index 3c9b40e..fedde60 100644 --- a/libappstream-glib/as-app-validate.c +++ b/libappstream-glib/as-app-validate.c @@ -230,7 +230,7 @@ as_app_validate_description (const gchar *xml, { GNode *l; GNode *l2; - _cleanup_unref_node GNode *node; + _cleanup_node_unref_ GNode *node; /* parse xml */ node = as_node_from_xml (xml, -1, @@ -332,10 +332,10 @@ ai_app_validate_image_check (AsImage *im, AsAppValidateHelper *helper) guint ss_size_height_min = 351; guint ss_size_width_max = 1600; guint ss_size_width_min = 624; - _cleanup_unref_object GdkPixbuf *pixbuf = NULL; - _cleanup_unref_object GInputStream *stream = NULL; - _cleanup_unref_object SoupMessage *msg = NULL; - _cleanup_unref_uri SoupURI *base_uri = NULL; + _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL; + _cleanup_object_unref_ GInputStream *stream = NULL; + _cleanup_object_unref_ SoupMessage *msg = NULL; + _cleanup_uri_unref_ SoupURI *base_uri = NULL; /* make the requirements more strict */ if ((helper->flags & AS_APP_VALIDATE_FLAG_STRICT) > 0) { @@ -690,7 +690,7 @@ static gboolean as_app_validate_license (const gchar *license_text, GError **error) { guint i; - _cleanup_free_strv gchar **licenses = NULL; + _cleanup_strv_free_ gchar **licenses = NULL; licenses = as_utils_spdx_license_tokenize (license_text); for (i = 0; licenses[i] != NULL; i++) { @@ -751,7 +751,7 @@ as_app_validate (AsApp *app, AsAppValidateFlags flags, GError **error) guint number_para_max = 4; guint number_para_min = 2; guint str_len; - _cleanup_free_list GList *keys = NULL; + _cleanup_list_free_ GList *keys = NULL; /* relax the requirements a bit */ if ((flags & AS_APP_VALIDATE_FLAG_RELAX) > 0) { diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 2c911d1..96929cd 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -1506,7 +1506,7 @@ as_app_subsume_dict (GHashTable *dest, GHashTable *src, gboolean overwrite) const gchar *tmp; const gchar *key; const gchar *value; - _cleanup_free_list GList *keys; + _cleanup_list_free_ GList *keys; keys = g_hash_table_get_keys (src); for (l = keys; l != NULL; l = l->next) { @@ -1536,7 +1536,7 @@ as_app_subsume_private (AsApp *app, AsApp *donor, AsAppSubsumeFlags flags) guint i; gint percentage; GList *l; - _cleanup_free_list GList *keys; + _cleanup_list_free_ GList *keys; overwrite = (flags & AS_APP_SUBSUME_FLAG_NO_OVERWRITE) == 0; @@ -1649,7 +1649,7 @@ as_app_node_insert_languages (AsApp *app, GNode *parent) const gchar *locale; gchar tmp[4]; gint percentage; - _cleanup_free_list GList *langs; + _cleanup_list_free_ GList *langs; node_tmp = as_node_insert (parent, "languages", NULL, 0, NULL); langs = as_app_get_languages (app); @@ -1933,7 +1933,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error) /* unwrap appdata inline */ if (priv->source_kind == AS_APP_SOURCE_KIND_APPDATA) { - _cleanup_unref_hashtable GHashTable *unwrapped; + _cleanup_hashtable_unref_ GHashTable *unwrapped; unwrapped = as_node_get_localized_unwrap (n, error); if (unwrapped == NULL) return FALSE; @@ -1948,7 +1948,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error) as_node_get_data (n), -1); } else { - _cleanup_free_string GString *xml; + _cleanup_string_free_ GString *xml; xml = as_node_to_xml (n->children, AS_NODE_TO_XML_FLAG_INCLUDE_SIBLINGS); as_app_set_description (app, @@ -2045,7 +2045,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error) case AS_TAG_SCREENSHOTS: g_ptr_array_set_size (priv->screenshots, 0); for (c = n->children; c != NULL; c = c->next) { - _cleanup_unref_object AsScreenshot *ss = NULL; + _cleanup_object_unref_ AsScreenshot *ss = NULL; if (as_node_get_tag (c) != AS_TAG_SCREENSHOT) continue; ss = as_screenshot_new (); @@ -2059,7 +2059,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error) case AS_TAG_RELEASES: g_ptr_array_set_size (priv->releases, 0); for (c = n->children; c != NULL; c = c->next) { - _cleanup_unref_object AsRelease *r = NULL; + _cleanup_object_unref_ AsRelease *r = NULL; if (as_node_get_tag (c) != AS_TAG_RELEASE) continue; r = as_release_new (); @@ -2073,7 +2073,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error) case AS_TAG_PROVIDES: g_ptr_array_set_size (priv->provides, 0); for (c = n->children; c != NULL; c = c->next) { - _cleanup_unref_object AsProvide *p; + _cleanup_object_unref_ AsProvide *p; p = as_provide_new (); if (!as_provide_node_parse (p, c, error)) return FALSE; @@ -2360,7 +2360,7 @@ as_app_infer_file_key (AsApp *app, const gchar *key, GError **error) { - _cleanup_free gchar *tmp = NULL; + _cleanup_free_ gchar *tmp = NULL; if (g_strcmp0 (key, "X-GNOME-UsesNotifications") == 0) { as_app_add_metadata (app, "X-Kudo-UsesNotifications", "", -1); @@ -2406,9 +2406,9 @@ as_app_parse_file_key (AsApp *app, { gchar *dot = NULL; guint i; - _cleanup_free gchar *locale = NULL; - _cleanup_free gchar *tmp = NULL; - _cleanup_free_strv gchar **list = NULL; + _cleanup_free_ gchar *locale = NULL; + _cleanup_free_ gchar *tmp = NULL; + _cleanup_strv_free_ gchar **list = NULL; /* NoDisplay */ if (g_strcmp0 (key, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY) == 0) { @@ -2569,9 +2569,9 @@ as_app_parse_desktop_file (AsApp *app, GKeyFileFlags kf_flags = G_KEY_FILE_KEEP_TRANSLATIONS; gchar *tmp; guint i; - _cleanup_free gchar *app_id = NULL; - _cleanup_unref_keyfile GKeyFile *kf = NULL; - _cleanup_free_strv gchar **keys = NULL; + _cleanup_free_ gchar *app_id = NULL; + _cleanup_keyfile_unref_ GKeyFile *kf = NULL; + _cleanup_strv_free_ gchar **keys = NULL; /* load file */ kf = g_key_file_new (); @@ -2654,8 +2654,8 @@ as_app_parse_appdata_file (AsApp *app, gboolean seen_application = FALSE; gchar *tmp; gsize len; - _cleanup_free gchar *data = NULL; - _cleanup_unref_node GNode *root = NULL; + _cleanup_free_ gchar *data = NULL; + _cleanup_node_unref_ GNode *root = NULL; /* open file */ if (!g_file_get_contents (filename, &data, &len, error)) diff --git a/libappstream-glib/as-cleanup.h b/libappstream-glib/as-cleanup.h index a635d03..6408cf1 100644 --- a/libappstream-glib/as-cleanup.h +++ b/libappstream-glib/as-cleanup.h @@ -73,24 +73,24 @@ GS_DEFINE_CLEANUP_FUNCTION(char**, gs_local_strfreev, g_strfreev) GS_DEFINE_CLEANUP_FUNCTION(GList*, gs_local_free_list, g_list_free) GS_DEFINE_CLEANUP_FUNCTION(void*, gs_local_free, g_free) -#define _cleanup_close_dir __attribute__ ((cleanup(gs_local_dir_close))) -#define _cleanup_destroy_timer __attribute__ ((cleanup(gs_local_destroy_timer))) -#define _cleanup_free __attribute__ ((cleanup(gs_local_free))) -#define _cleanup_free_checksum __attribute__ ((cleanup(gs_local_checksum_free))) -#define _cleanup_free_error __attribute__ ((cleanup(gs_local_free_error))) -#define _cleanup_free_list __attribute__ ((cleanup(gs_local_free_list))) -#define _cleanup_free_string __attribute__ ((cleanup(gs_local_free_string))) -#define _cleanup_free_strv __attribute__ ((cleanup(gs_local_strfreev))) -#define _cleanup_unref_array __attribute__ ((cleanup(gs_local_array_unref))) -#define _cleanup_unref_bytes __attribute__ ((cleanup(gs_local_bytes_unref))) -#define _cleanup_unref_hashtable __attribute__ ((cleanup(gs_local_hashtable_unref))) -#define _cleanup_unref_keyfile __attribute__ ((cleanup(gs_local_keyfile_unref))) -#define _cleanup_unref_markup_parse_context __attribute__ ((cleanup(gs_local_markup_parse_context_unref))) -#define _cleanup_unref_node __attribute__ ((cleanup(gs_local_node_unref))) -#define _cleanup_unref_object __attribute__ ((cleanup(gs_local_obj_unref))) -#define _cleanup_unref_ptrarray __attribute__ ((cleanup(gs_local_ptrarray_unref))) -#define _cleanup_unref_uri __attribute__ ((cleanup(gs_local_uri_unref))) -#define _cleanup_unref_variant __attribute__ ((cleanup(gs_local_variant_unref))) +#define _cleanup_dir_close_ __attribute__ ((cleanup(gs_local_dir_close))) +#define _cleanup_timer_destroy_ __attribute__ ((cleanup(gs_local_destroy_timer))) +#define _cleanup_free_ __attribute__ ((cleanup(gs_local_free))) +#define _cleanup_checksum_free_ __attribute__ ((cleanup(gs_local_checksum_free))) +#define _cleanup_error_free_ __attribute__ ((cleanup(gs_local_free_error))) +#define _cleanup_list_free_ __attribute__ ((cleanup(gs_local_free_list))) +#define _cleanup_string_free_ __attribute__ ((cleanup(gs_local_free_string))) +#define _cleanup_strv_free_ __attribute__ ((cleanup(gs_local_strfreev))) +#define _cleanup_array_unref_ __attribute__ ((cleanup(gs_local_array_unref))) +#define _cleanup_bytes_unref_ __attribute__ ((cleanup(gs_local_bytes_unref))) +#define _cleanup_hashtable_unref_ __attribute__ ((cleanup(gs_local_hashtable_unref))) +#define _cleanup_keyfile_unref_ __attribute__ ((cleanup(gs_local_keyfile_unref))) +#define _cleanup_markup_parse_context_unref_ __attribute__ ((cleanup(gs_local_markup_parse_context_unref))) +#define _cleanup_node_unref_ __attribute__ ((cleanup(gs_local_node_unref))) +#define _cleanup_object_unref_ __attribute__ ((cleanup(gs_local_obj_unref))) +#define _cleanup_ptrarray_unref_ __attribute__ ((cleanup(gs_local_ptrarray_unref))) +#define _cleanup_uri_unref_ __attribute__ ((cleanup(gs_local_uri_unref))) +#define _cleanup_variant_unref_ __attribute__ ((cleanup(gs_local_variant_unref))) G_END_DECLS diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c index e0bec3d..0f8ea13 100644 --- a/libappstream-glib/as-image.c +++ b/libappstream-glib/as-image.c @@ -459,9 +459,9 @@ as_image_load_filename (AsImage *image, { AsImagePrivate *priv = GET_PRIVATE (image); gsize len; - _cleanup_free gchar *basename = NULL; - _cleanup_free gchar *data = NULL; - _cleanup_unref_object GdkPixbuf *pixbuf = NULL; + _cleanup_free_ gchar *basename = NULL; + _cleanup_free_ gchar *data = NULL; + _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL; /* get the contents so we can hash the predictable file data, * rather than the unpredicatable (for JPEG) pixel data */ @@ -507,7 +507,7 @@ as_image_save_pixbuf (AsImage *image, guint tmp_width; guint pixbuf_height; guint pixbuf_width; - _cleanup_unref_object GdkPixbuf *pixbuf_tmp = NULL; + _cleanup_object_unref_ GdkPixbuf *pixbuf_tmp = NULL; /* 0 means 'default' */ if (width == 0) @@ -573,7 +573,7 @@ as_image_save_filename (AsImage *image, AsImageSaveFlags flags, GError **error) { - _cleanup_unref_object GdkPixbuf *pixbuf; + _cleanup_object_unref_ GdkPixbuf *pixbuf; /* save source file */ pixbuf = as_image_save_pixbuf (image, width, height, flags); diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c index cc22721..d667c95 100644 --- a/libappstream-glib/as-node.c +++ b/libappstream-glib/as-node.c @@ -182,8 +182,8 @@ as_node_error_quark (void) static void as_node_string_replace (GString *string, const gchar *search, const gchar *replace) { - _cleanup_free gchar *tmp = NULL; - _cleanup_free_strv gchar **split = NULL; + _cleanup_free_ gchar *tmp = NULL; + _cleanup_strv_free_ gchar **split = NULL; /* quick search */ if (g_strstr_len (string->str, -1, search) == NULL) @@ -574,7 +574,7 @@ as_node_passthrough_cb (GMarkupParseContext *context, AsNodeToXmlHelper *helper = (AsNodeToXmlHelper *) user_data; const gchar *tmp; gchar *found; - _cleanup_free gchar *text = NULL; + _cleanup_free_ gchar *text = NULL; /* only keep comments when told to */ if ((helper->flags & AS_NODE_FROM_XML_FLAG_KEEP_COMMENTS) == 0) @@ -621,8 +621,8 @@ as_node_from_xml (const gchar *data, AsNodeToXmlHelper helper; GNode *root = NULL; gboolean ret; - _cleanup_unref_markup_parse_context GMarkupParseContext *ctx = NULL; - _cleanup_free_error GError *error_local = NULL; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_markup_parse_context_unref_ GMarkupParseContext *ctx = NULL; const GMarkupParser parser = { as_node_start_element_cb, as_node_end_element_cb, @@ -690,12 +690,12 @@ as_node_from_file (GFile *file, gboolean ret = TRUE; gsize chunk_size = 32 * 1024; gssize len; - _cleanup_free gchar *data = NULL; - _cleanup_unref_markup_parse_context GMarkupParseContext *ctx = NULL; - _cleanup_unref_object GConverter *conv = NULL; - _cleanup_unref_object GFileInfo *info = NULL; - _cleanup_unref_object GInputStream *file_stream = NULL; - _cleanup_unref_object GInputStream *stream_data = NULL; + _cleanup_free_ gchar *data = NULL; + _cleanup_markup_parse_context_unref_ GMarkupParseContext *ctx = NULL; + _cleanup_object_unref_ GConverter *conv = NULL; + _cleanup_object_unref_ GFileInfo *info = NULL; + _cleanup_object_unref_ GInputStream *file_stream = NULL; + _cleanup_object_unref_ GInputStream *stream_data = NULL; const GMarkupParser parser = { as_node_start_element_cb, as_node_end_element_cb, @@ -1126,7 +1126,7 @@ as_node_find (GNode *root, const gchar *path) { GNode *node = root; guint i; - _cleanup_free_strv gchar **split = NULL; + _cleanup_strv_free_ gchar **split = NULL; g_return_val_if_fail (path != NULL, NULL); @@ -1219,7 +1219,7 @@ as_node_insert_localized (GNode *parent, const gchar *key; const gchar *value; const gchar *value_c; - _cleanup_free_list GList *list = NULL; + _cleanup_list_free_ GList *list = NULL; /* add the untranslated value first */ value_c = g_hash_table_lookup (localized, "C"); @@ -1376,7 +1376,7 @@ as_node_get_localized (const GNode *node, const gchar *key) const gchar * as_node_get_localized_best (const GNode *node, const gchar *key) { - _cleanup_unref_hashtable GHashTable *hash = NULL; + _cleanup_hashtable_unref_ GHashTable *hash = NULL; hash = as_node_get_localized (node, key); if (hash == NULL) return NULL; @@ -1403,7 +1403,7 @@ as_node_denorm_add_to_langs (GHashTable *hash, GList *l; GString *str; const gchar *xml_lang; - _cleanup_free_list GList *keys = NULL; + _cleanup_list_free_ GList *keys = NULL; keys = g_hash_table_get_keys (hash); for (l = keys; l != NULL; l = l->next) { @@ -1640,8 +1640,8 @@ as_node_get_localized_unwrap (const GNode *node, GError **error) GString *str; const gchar *xml_lang; gboolean is_li_translated = TRUE; - _cleanup_free_list GList *keys = NULL; - _cleanup_unref_hashtable GHashTable *hash = NULL; + _cleanup_hashtable_unref_ GHashTable *hash = NULL; + _cleanup_list_free_ GList *keys = NULL; /* work out what kind of normalization this is */ for (tmp = node->children; tmp != NULL; tmp = tmp->next) { diff --git a/libappstream-glib/as-release.c b/libappstream-glib/as-release.c index 404bc1a..98adb7c 100644 --- a/libappstream-glib/as-release.c +++ b/libappstream-glib/as-release.c @@ -228,7 +228,7 @@ as_release_node_insert (AsRelease *release, GNode *parent, gdouble api_version) { AsReleasePrivate *priv = GET_PRIVATE (release); GNode *n; - _cleanup_free gchar *timestamp_str; + _cleanup_free_ gchar *timestamp_str; timestamp_str = g_strdup_printf ("%" G_GUINT64_FORMAT, priv->timestamp); @@ -276,7 +276,7 @@ as_release_node_parse (AsRelease *release, GNode *node, GError **error) /* descriptions are translated and optional */ for (n = node->children; n != NULL; n = n->next) { - _cleanup_free_string GString *xml = NULL; + _cleanup_string_free_ GString *xml = NULL; if (as_node_get_tag (n) != AS_TAG_DESCRIPTION) continue; xml = as_node_to_xml (n->children, AS_NODE_TO_XML_FLAG_NONE); diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c index bc3393d..87547cf 100644 --- a/libappstream-glib/as-screenshot.c +++ b/libappstream-glib/as-screenshot.c @@ -323,7 +323,7 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node, GError **error) GNode *c; const gchar *tmp; guint size; - _cleanup_unref_hashtable GHashTable *captions = NULL; + _cleanup_hashtable_unref_ GHashTable *captions = NULL; tmp = as_node_get_attribute (node, "type"); if (tmp != NULL) { @@ -334,7 +334,7 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node, GError **error) /* add captions */ captions = as_node_get_localized (node, "caption"); if (captions != NULL) { - _cleanup_free_list GList *keys; + _cleanup_list_free_ GList *keys; keys = g_hash_table_get_keys (captions); for (l = keys; l != NULL; l = l->next) { tmp = l->data; @@ -363,7 +363,7 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node, GError **error) /* add images */ for (c = node->children; c != NULL; c = c->next) { - _cleanup_unref_object AsImage *image = NULL; + _cleanup_object_unref_ AsImage *image = NULL; if (as_node_get_tag (c) != AS_TAG_IMAGE) continue; image = as_image_new (); diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c index 2059776..9859646 100644 --- a/libappstream-glib/as-self-test.c +++ b/libappstream-glib/as-self-test.c @@ -45,7 +45,7 @@ as_test_get_filename (const gchar *filename) { char full_tmp[PATH_MAX]; gchar *tmp; - _cleanup_free gchar *path = NULL; + _cleanup_free_ gchar *path = NULL; path = g_build_filename (TESTDATADIR, filename, NULL); tmp = realpath (path, full_tmp); @@ -84,7 +84,7 @@ ch_test_release_func (void) GString *xml; const gchar *src = "<release version=\"0.1.2\" timestamp=\"123\"/>"; gboolean ret; - _cleanup_unref_object AsRelease *release = NULL; + _cleanup_object_unref_ AsRelease *release = NULL; release = as_release_new (); @@ -121,7 +121,7 @@ ch_test_provide_func (void) GString *xml; const gchar *src = "<binary>/usr/bin/gnome-shell</binary>"; gboolean ret; - _cleanup_unref_object AsProvide *provide = NULL; + _cleanup_object_unref_ AsProvide *provide = NULL; provide = as_provide_new (); @@ -162,7 +162,7 @@ ch_test_release_desc_func (void) "<description><p>This is a new release</p></description>" "<description xml:lang=\"pl\"><p>Oprogramowanie</p></description>" "</release>"; - _cleanup_unref_object AsRelease *release; + _cleanup_object_unref_ AsRelease *release; release = as_release_new (); @@ -203,9 +203,9 @@ ch_test_image_func (void) "<image type=\"thumbnail\" height=\"12\" width=\"34\">" "http://www.hughsie.com/a.jpg</image>"; gboolean ret; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object AsImage *image = NULL; - _cleanup_unref_object GdkPixbuf *pixbuf = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ AsImage *image = NULL; + _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL; image = as_image_new (); @@ -277,7 +277,7 @@ ch_test_screenshot_func (void) "<image type=\"thumbnail\">http://2.png</image>" "</screenshot>"; gboolean ret; - _cleanup_unref_object AsScreenshot *screenshot = NULL; + _cleanup_object_unref_ AsScreenshot *screenshot = NULL; screenshot = as_screenshot_new (); @@ -364,7 +364,7 @@ ch_test_app_func (void) "<value key=\"X-Kudo-GTK3\"/>" "</metadata>" "</component>"; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_object_unref_ AsApp *app = NULL; app = as_app_new (); @@ -446,8 +446,8 @@ ch_test_app_validate_file_good_func (void) GPtrArray *screenshots; gboolean ret; guint i; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ AsApp *app = NULL; /* open file */ app = as_app_new (); @@ -500,8 +500,8 @@ ch_test_app_validate_intltool_func (void) GPtrArray *probs; gboolean ret; guint i; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ AsApp *app = NULL; /* open file */ app = as_app_new (); @@ -531,8 +531,8 @@ ch_test_app_translated_func (void) { GError *error = NULL; gboolean ret; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ AsApp *app = NULL; /* open file */ app = as_app_new (); @@ -554,9 +554,9 @@ ch_test_app_validate_file_bad_func (void) GError *error = NULL; gboolean ret; guint i; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object AsApp *app = NULL; - _cleanup_unref_ptrarray GPtrArray *probs = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ AsApp *app = NULL; + _cleanup_ptrarray_unref_ GPtrArray *probs = NULL; /* open file */ app = as_app_new (); @@ -628,8 +628,8 @@ ch_test_app_validate_style_func (void) AsProblem *problem; GError *error = NULL; guint i; - _cleanup_unref_object AsApp *app = NULL; - _cleanup_unref_ptrarray GPtrArray *probs = NULL; + _cleanup_object_unref_ AsApp *app = NULL; + _cleanup_ptrarray_unref_ GPtrArray *probs = NULL; app = as_app_new (); as_app_add_url (app, AS_URL_KIND_UNKNOWN, "dave.com", -1); @@ -679,8 +679,8 @@ ch_test_app_parse_file_func (void) { GError *error = NULL; gboolean ret; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ AsApp *app = NULL; /* create an AsApp from a desktop file */ app = as_app_new (); @@ -735,7 +735,7 @@ ch_test_app_no_markup_func (void) "<id type=\"desktop\">org.gnome.Software.desktop</id>" "<description>Software is awesome:\n\n * Bada\n * Boom!</description>" "</application>"; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_object_unref_ AsApp *app = NULL; app = as_app_new (); @@ -802,7 +802,7 @@ ch_test_node_func (void) { GNode *n1; GNode *n2; - _cleanup_unref_node GNode *root = NULL; + _cleanup_node_unref_ GNode *root = NULL; /* create a simple tree */ root = as_node_new (); @@ -1019,8 +1019,8 @@ ch_test_node_localized_wrap_func (void) " <li xml:lang=\"en_GB\">Hi</li>" " </ul>" "</description>"; - _cleanup_unref_hashtable GHashTable *hash = NULL; - _cleanup_unref_node GNode *root = NULL; + _cleanup_hashtable_unref_ GHashTable *hash = NULL; + _cleanup_node_unref_ GNode *root = NULL; root = as_node_from_xml (xml, -1, 0, &error); g_assert_no_error (error); @@ -1059,8 +1059,8 @@ ch_test_node_localized_wrap2_func (void) " <li>Secondski</li>" " </ul>" "</description>"; - _cleanup_unref_hashtable GHashTable *hash = NULL; - _cleanup_unref_node GNode *root = NULL; + _cleanup_hashtable_unref_ GHashTable *hash = NULL; + _cleanup_node_unref_ GNode *root = NULL; root = as_node_from_xml (xml, -1, 0, &error); g_assert_no_error (error); @@ -1083,8 +1083,8 @@ static void ch_test_app_subsume_func (void) { GList *list; - _cleanup_unref_object AsApp *app = NULL; - _cleanup_unref_object AsApp *donor = NULL; + _cleanup_object_unref_ AsApp *app = NULL; + _cleanup_object_unref_ AsApp *donor = NULL; donor = as_app_new (); as_app_set_icon (donor, "gtk-find", -1); @@ -1122,7 +1122,7 @@ ch_test_app_search_func (void) const gchar *all[] = { "gnome", "install", "software", NULL }; const gchar *none[] = { "gnome", "xxx", "software", NULL }; const gchar *mime[] = { "application", "vnd", "oasis", "opendocument","text", NULL }; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_object_unref_ AsApp *app = NULL; app = as_app_new (); as_app_set_name (app, NULL, "GNOME Software", -1); @@ -1142,7 +1142,7 @@ ch_test_store_func (void) { AsApp *app; GString *xml; - _cleanup_unref_object AsStore *store = NULL; + _cleanup_object_unref_ AsStore *store = NULL; /* create a store and add a single app */ store = as_store_new (); @@ -1301,7 +1301,7 @@ ch_test_node_no_dup_c_func (void) "<name>Krita</name>" "<name xml:lang=\"pl\">Krita</name>" "</application>"; - _cleanup_unref_object AsApp *app = NULL; + _cleanup_object_unref_ AsApp *app = NULL; /* to object */ app = as_app_new (); @@ -1338,9 +1338,9 @@ ch_test_store_origin_func (void) AsApp *app; GError *error = NULL; gboolean ret; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object AsStore *store = NULL; - _cleanup_unref_object GFile *file = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ AsStore *store = NULL; + _cleanup_object_unref_ GFile *file = NULL; /* load a file to the store */ store = as_store_new (); @@ -1366,15 +1366,15 @@ ch_test_store_speed_func (void) gboolean ret; guint i; guint loops = 10; - _cleanup_destroy_timer GTimer *timer = NULL; - _cleanup_free gchar *filename = NULL; - _cleanup_unref_object GFile *file = NULL; + _cleanup_free_ gchar *filename = NULL; + _cleanup_object_unref_ GFile *file = NULL; + _cleanup_timer_destroy_ GTimer *timer = NULL; filename = as_test_get_filename ("example-v04.xml.gz"); file = g_file_new_for_path (filename); timer = g_timer_new (); for (i = 0; i < loops; i++) { - _cleanup_unref_object AsStore *store; + _cleanup_object_unref_ AsStore *store; store = as_store_new (); ret = as_store_from_file (store, file, NULL, NULL, &error); g_assert_no_error (error); @@ -1514,7 +1514,7 @@ ch_test_store_app_install_func (void) { GError *error = NULL; gboolean ret; - _cleanup_unref_object AsStore *store = NULL; + _cleanup_object_unref_ AsStore *store = NULL; store = as_store_new (); ret = as_store_load (store, @@ -1546,7 +1546,7 @@ ch_test_store_metadata_func (void) "</metadata>" "</application>" "</applications>"; - _cleanup_unref_object AsStore *store = NULL; + _cleanup_object_unref_ AsStore *store = NULL; store = as_store_new (); ret = as_store_from_xml (store, xml, -1, NULL, &error); diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c index bfc5b26..adac024 100644 --- a/libappstream-glib/as-store.c +++ b/libappstream-glib/as-store.c @@ -357,7 +357,7 @@ as_store_from_root (AsStore *store, GNode *apps; GNode *n; const gchar *tmp; - _cleanup_free gchar *icon_path = NULL; + _cleanup_free_ gchar *icon_path = NULL; g_return_val_if_fail (AS_IS_STORE (store), FALSE); @@ -439,8 +439,8 @@ as_store_from_file (AsStore *store, GCancellable *cancellable, GError **error) { - _cleanup_free_error GError *error_local = NULL; - _cleanup_unref_node GNode *root = NULL; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_node_unref_ GNode *root = NULL; g_return_val_if_fail (AS_IS_STORE (store), FALSE); @@ -484,8 +484,8 @@ as_store_from_xml (AsStore *store, const gchar *icon_root, GError **error) { - _cleanup_free_error GError *error_local = NULL; - _cleanup_unref_node GNode *root = NULL; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_node_unref_ GNode *root = NULL; g_return_val_if_fail (AS_IS_STORE (store), FALSE); @@ -588,11 +588,11 @@ as_store_to_file (AsStore *store, GCancellable *cancellable, GError **error) { - _cleanup_free_error GError *error_local = NULL; - _cleanup_free_string GString *xml = NULL; - _cleanup_unref_object GOutputStream *out2 = NULL; - _cleanup_unref_object GOutputStream *out = NULL; - _cleanup_unref_object GZlibCompressor *compressor = NULL; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_object_unref_ GOutputStream *out2 = NULL; + _cleanup_object_unref_ GOutputStream *out = NULL; + _cleanup_object_unref_ GZlibCompressor *compressor = NULL; + _cleanup_string_free_ GString *xml = NULL; /* compress as a gzip file */ compressor = g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP, -1); @@ -713,7 +713,7 @@ as_store_guess_origin_fallback (AsStore *store, GError **error) { gchar *tmp; - _cleanup_free gchar *origin_fallback; + _cleanup_free_ gchar *origin_fallback; /* the first component of the file (e.g. "fedora-20.xml.gz) * is used for the icon directory as we might want to clean up @@ -746,7 +746,7 @@ as_store_load_app_info_file (AsStore *store, GCancellable *cancellable, GError **error) { - _cleanup_unref_object GFile *file = NULL; + _cleanup_object_unref_ GFile *file = NULL; /* guess this based on the name */ if (!as_store_guess_origin_fallback (store, path_xml, error)) @@ -786,9 +786,9 @@ as_store_monitor_directory (AsStore *store, GError **error) { AsStorePrivate *priv = GET_PRIVATE (store); - _cleanup_free_error GError *error_local = NULL; - _cleanup_unref_object GFile *file = NULL; - _cleanup_unref_object GFileMonitor *monitor = NULL; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_object_unref_ GFile *file = NULL; + _cleanup_object_unref_ GFileMonitor *monitor = NULL; file = g_file_new_for_path (path); monitor = g_file_monitor_directory (file, @@ -820,10 +820,10 @@ as_store_load_app_info (AsStore *store, GError **error) { const gchar *tmp; - _cleanup_close_dir GDir *dir = NULL; - _cleanup_free_error GError *error_local = NULL; - _cleanup_free gchar *icon_root = NULL; - _cleanup_free gchar *path_xml = NULL; + _cleanup_dir_close_ GDir *dir = NULL; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_free_ gchar *icon_root = NULL; + _cleanup_free_ gchar *path_xml = NULL; /* watch the directory for changes */ if (!as_store_monitor_directory (store, path, cancellable, error)) @@ -844,7 +844,7 @@ as_store_load_app_info (AsStore *store, } icon_root = g_build_filename (path, "icons", NULL); while ((tmp = g_dir_read_name (dir)) != NULL) { - _cleanup_free gchar *filename_xml; + _cleanup_free_ gchar *filename_xml; filename_xml = g_build_filename (path_xml, tmp, NULL); if (!as_store_load_app_info_file (store, filename_xml, @@ -864,9 +864,9 @@ as_store_add_app_install_screenshot (AsApp *app) { GPtrArray *pkgnames; const gchar *pkgname; - _cleanup_free gchar *url = NULL; - _cleanup_unref_object AsImage *im = NULL; - _cleanup_unref_object AsScreenshot *ss = NULL; + _cleanup_free_ gchar *url = NULL; + _cleanup_object_unref_ AsImage *im = NULL; + _cleanup_object_unref_ AsScreenshot *ss = NULL; /* get the default package name */ pkgnames = as_app_get_pkgnames (app); @@ -897,8 +897,8 @@ as_store_load_app_install_file (AsStore *store, const gchar *path_icons, GError **error) { - _cleanup_free_error GError *error_local = NULL; - _cleanup_unref_object AsApp *app; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_object_unref_ AsApp *app; app = as_app_new (); if (!as_app_parse_file (app, @@ -937,10 +937,10 @@ as_store_load_app_install (AsStore *store, GError **error) { const gchar *tmp; - _cleanup_free_error GError *error_local = NULL; - _cleanup_close_dir GDir *dir = NULL; - _cleanup_free gchar *path_desktop = NULL; - _cleanup_free gchar *path_icons = NULL; + _cleanup_dir_close_ GDir *dir = NULL; + _cleanup_error_free_ GError *error_local = NULL; + _cleanup_free_ gchar *path_desktop = NULL; + _cleanup_free_ gchar *path_icons = NULL; path_desktop = g_build_filename (path, "desktop", NULL); if (!g_file_test (path_desktop, G_FILE_TEST_EXISTS)) @@ -958,7 +958,7 @@ as_store_load_app_install (AsStore *store, path_icons = g_build_filename (path, "icons", NULL); while ((tmp = g_dir_read_name (dir)) != NULL) { - _cleanup_free gchar *filename = NULL; + _cleanup_free_ gchar *filename = NULL; if (!g_str_has_suffix (tmp, ".desktop")) continue; filename = g_build_filename (path_desktop, tmp, NULL); @@ -994,7 +994,7 @@ as_store_load (AsStore *store, const gchar *tmp; gchar *path; guint i; - _cleanup_unref_ptrarray GPtrArray *app_info = NULL; + _cleanup_ptrarray_unref_ GPtrArray *app_info = NULL; /* system locations */ app_info = g_ptr_array_new_with_free_func (g_free); diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c index 7c45fe7..8f89e8b 100644 --- a/libappstream-glib/as-utils.c +++ b/libappstream-glib/as-utils.c @@ -80,8 +80,8 @@ as_markup_convert_simple (const gchar *markup, GNode *tmp_c; const gchar *tag; const gchar *tag_c; - _cleanup_free_string GString *str = NULL; - _cleanup_unref_node GNode *root = NULL; + _cleanup_node_unref_ GNode *root = NULL; + _cleanup_string_free_ GString *str = NULL; /* is this actually markup */ if (g_strstr_len (markup, markup_len, "<") == NULL) @@ -192,8 +192,8 @@ as_hash_lookup_by_locale (GHashTable *hash, const gchar *locale) gboolean as_utils_is_stock_icon_name (const gchar *name) { - _cleanup_free gchar *key = NULL; - _cleanup_unref_bytes GBytes *data; + _cleanup_bytes_unref_ GBytes *data; + _cleanup_free_ gchar *key = NULL; /* load the readonly data section and look for the icon name */ data = g_resource_lookup_data (as_get_resource (), @@ -219,8 +219,8 @@ as_utils_is_stock_icon_name (const gchar *name) gboolean as_utils_is_spdx_license_id (const gchar *license_id) { - _cleanup_free gchar *key = NULL; - _cleanup_unref_bytes GBytes *data; + _cleanup_bytes_unref_ GBytes *data; + _cleanup_free_ gchar *key = NULL; /* load the readonly data section and look for the icon name */ data = g_resource_lookup_data (as_get_resource (), @@ -357,9 +357,9 @@ as_util_get_possible_kudos (void) gboolean as_utils_check_url_exists (const gchar *url, guint timeout, GError **error) { - _cleanup_unref_object SoupMessage *msg = NULL; - _cleanup_unref_object SoupSession *session = NULL; - _cleanup_unref_uri SoupURI *base_uri = NULL; + _cleanup_object_unref_ SoupMessage *msg = NULL; + _cleanup_object_unref_ SoupSession *session = NULL; + _cleanup_uri_unref_ SoupURI *base_uri = NULL; /* GET file */ base_uri = soup_uri_new (url); |