[Xfce4-commits] <garcon:master> Plug leak in garcon_menu_resolve_items() and use GSList.
Nick Schermer
noreply at xfce.org
Sat Jun 25 21:18:02 CEST 2011
Updating branch refs/heads/master
to 3c1bc907eeea622486b82f14651b4978a8fc8fd9 (commit)
from 3b303dddc60d6fd94d70107f8cd73ad0aac3b04d (commit)
commit 3c1bc907eeea622486b82f14651b4978a8fc8fd9
Author: Nick Schermer <nick at xfce.org>
Date: Sat Jun 25 21:11:36 2011 +0200
Plug leak in garcon_menu_resolve_items() and use GSList.
garcon/garcon-menu.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/garcon/garcon-menu.c b/garcon/garcon-menu.c
index cafd7a7..05e77e8 100644
--- a/garcon/garcon-menu.c
+++ b/garcon/garcon-menu.c
@@ -1188,8 +1188,8 @@ garcon_menu_collect_files_from_path (GarconMenu *menu,
static gboolean
-collect_rules (GNode *node,
- GList **list)
+collect_rules (GNode *node,
+ GSList **list)
{
GarconMenuNodeType type;
@@ -1198,7 +1198,7 @@ collect_rules (GNode *node,
if (type == GARCON_MENU_NODE_TYPE_INCLUDE ||
type == GARCON_MENU_NODE_TYPE_EXCLUDE)
{
- *list = g_list_append (*list, node);
+ *list = g_slist_append (*list, node);
}
return FALSE;
@@ -1211,8 +1211,9 @@ garcon_menu_resolve_items (GarconMenu *menu,
GHashTable *desktop_id_table,
gboolean only_unallocated)
{
- GList *rules = NULL;
- GList *iter;
+ GSList *rules = NULL;
+ GSList *iter;
+ GList *submenu;
gboolean menu_only_unallocated = FALSE;
g_return_if_fail (menu != NULL && GARCON_IS_MENU (menu));
@@ -1230,7 +1231,7 @@ garcon_menu_resolve_items (GarconMenu *menu,
(GNodeTraverseFunc) collect_rules, &rules);
/* Iterate over all rules */
- for (iter = rules; iter != NULL; iter = g_list_next (iter))
+ for (iter = rules; iter != NULL; iter = g_slist_next (iter))
{
if (G_LIKELY (garcon_menu_node_tree_get_node_type (iter->data) == GARCON_MENU_NODE_TYPE_INCLUDE))
{
@@ -1243,13 +1244,16 @@ garcon_menu_resolve_items (GarconMenu *menu,
garcon_menu_item_pool_apply_exclude_rule (menu->priv->pool, iter->data);
}
}
+
+ /* Cleanup */
+ g_slist_free (rules);
}
/* Iterate over all submenus */
- for (iter = menu->priv->submenus; iter != NULL; iter = g_list_next (iter))
+ for (submenu = menu->priv->submenus; submenu != NULL; submenu = g_list_next (submenu))
{
/* Resolve items of the submenu */
- garcon_menu_resolve_items (GARCON_MENU (iter->data), desktop_id_table, only_unallocated);
+ garcon_menu_resolve_items (GARCON_MENU (submenu->data), desktop_id_table, only_unallocated);
}
}
More information about the Xfce4-commits
mailing list