From 2156a92a098433f3e3a570bda9f2ab4e5ab53dcf Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Wed, 29 Aug 2012 20:57:31 +0200
Subject: Optimize removal from LdCategory.
---
liblogdiag/ld-category.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
(limited to 'liblogdiag')
diff --git a/liblogdiag/ld-category.c b/liblogdiag/ld-category.c
index d0b2245..e7b212d 100644
--- a/liblogdiag/ld-category.c
+++ b/liblogdiag/ld-category.c
@@ -298,12 +298,14 @@ ld_category_insert_symbol (LdCategory *self, LdSymbol *symbol, gint pos)
void
ld_category_remove_symbol (LdCategory *self, LdSymbol *symbol)
{
+ GSList *link;
+
g_return_if_fail (LD_IS_CATEGORY (self));
g_return_if_fail (LD_IS_SYMBOL (symbol));
- if (g_slist_find (self->priv->symbols, symbol))
+ if ((link = g_slist_find (self->priv->symbols, symbol)))
{
- self->priv->symbols = g_slist_remove (self->priv->symbols, symbol);
+ self->priv->symbols = g_slist_delete_link (self->priv->symbols, link);
g_object_unref (symbol);
}
}
@@ -390,15 +392,17 @@ ld_category_add_child (LdCategory *self, LdCategory *category)
void
ld_category_remove_child (LdCategory *self, LdCategory *category)
{
+ GSList *link;
+
g_return_if_fail (LD_IS_CATEGORY (self));
g_return_if_fail (LD_IS_CATEGORY (category));
- if (g_slist_find (self->priv->subcategories, category))
+ if ((link = g_slist_find (self->priv->subcategories, category)))
{
g_signal_handlers_disconnect_by_func (category,
on_category_notify_name, self);
self->priv->subcategories
- = g_slist_remove (self->priv->subcategories, category);
+ = g_slist_delete_link (self->priv->subcategories, link);
g_object_unref (category);
}
}
--
cgit v1.2.3-70-g09d2