[gtksourceview] Small refactoring to avoid double hash lookup
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Small refactoring to avoid double hash lookup
- Date: Sat, 10 Jul 2010 09:11:51 +0000 (UTC)
commit 9c2673fdcd38af979a60f4503bed4b31fa750e56
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Jul 10 10:00:12 2010 +0200
Small refactoring to avoid double hash lookup
gtksourceview/gtksourcecontextengine.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/gtksourceview/gtksourcecontextengine.c b/gtksourceview/gtksourcecontextengine.c
index 241a6c0..e18b0c1 100644
--- a/gtksourceview/gtksourcecontextengine.c
+++ b/gtksourceview/gtksourcecontextengine.c
@@ -688,8 +688,6 @@ create_tag (GtkSourceContextEngine *ce,
g_assert (style_id != NULL);
- tags = g_hash_table_lookup (ce->priv->tags, style_id);
-
new_tag = gtk_text_buffer_create_tag (ce->priv->buffer, NULL, NULL);
/* It must have priority lower than user tags but still
* higher than highlighting tags created before */
@@ -697,9 +695,6 @@ create_tag (GtkSourceContextEngine *ce,
set_tag_style (ce, new_tag, style_id);
ce->priv->n_tags += 1;
- tags = g_slist_prepend (tags, g_object_ref (new_tag));
- g_hash_table_insert (ce->priv->tags, g_strdup (style_id), tags);
-
return new_tag;
}
@@ -760,6 +755,9 @@ get_tag_for_parent (GtkSourceContextEngine *ce,
{
tag = create_tag (ce, style);
+ tags = g_slist_prepend (tags, g_object_ref (tag));
+ g_hash_table_insert (ce->priv->tags, g_strdup (style), tags);
+
#ifdef ENABLE_DEBUG
{
GString *style_path = g_string_new (style);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]