aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2012-08-29 20:57:31 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2012-10-08 07:29:57 +0200
commit2156a92a098433f3e3a570bda9f2ab4e5ab53dcf (patch)
tree75a4b277b6b0b7ddabd2627cd6d07c30057f0b72
parent9569d96cd6befed8a07d7bb7075b5ff00049a023 (diff)
downloadlogdiag-2156a92a098433f3e3a570bda9f2ab4e5ab53dcf.tar.gz
logdiag-2156a92a098433f3e3a570bda9f2ab4e5ab53dcf.tar.xz
logdiag-2156a92a098433f3e3a570bda9f2ab4e5ab53dcf.zip
Optimize removal from LdCategory.
-rw-r--r--liblogdiag/ld-category.c12
1 files changed, 8 insertions, 4 deletions
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);
}
}