[gspell: 8/8] utils: don't lookup no-spell-check tag each time
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell: 8/8] utils: don't lookup no-spell-check tag each time
- Date: Sun, 13 Dec 2015 14:35:43 +0000 (UTC)
commit 2fe7332c66e3217153211dc0e944ea06b79da17d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Dec 13 15:33:00 2015 +0100
utils: don't lookup no-spell-check tag each time
gspell/gspell-inline-checker-gtv.c | 2 +-
gspell/gspell-navigator-gtv.c | 5 ++++-
gspell/gspell-utils.c | 11 ++++-------
gspell/gspell-utils.h | 3 ++-
4 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-gtv.c b/gspell/gspell-inline-checker-gtv.c
index 23ecb38..2cc53f7 100644
--- a/gspell/gspell-inline-checker-gtv.c
+++ b/gspell/gspell-inline-checker-gtv.c
@@ -172,7 +172,7 @@ check_subregion (GspellInlineCheckerGtv *spell,
g_assert_cmpint (gtk_text_iter_compare (start, &word_start), <, 0);
}
- while (_gspell_utils_skip_no_spell_check (&word_start, end) &&
+ while (_gspell_utils_skip_no_spell_check (spell->no_spell_check_tag, &word_start, end) &&
gtk_text_iter_compare (&word_start, end) < 0)
{
GtkTextIter word_end;
diff --git a/gspell/gspell-navigator-gtv.c b/gspell/gspell-navigator-gtv.c
index b2d5911..9b53902 100644
--- a/gspell/gspell-navigator-gtv.c
+++ b/gspell/gspell-navigator-gtv.c
@@ -314,6 +314,7 @@ gspell_navigator_gtv_goto_next (GspellNavigator *navigator,
GspellNavigatorGtvPrivate *priv;
GtkTextIter word_start;
GtkTextIter end;
+ GtkTextTag *no_spell_check_tag;
priv = gspell_navigator_gtv_get_instance_private (GSPELL_NAVIGATOR_GTV (navigator));
@@ -364,6 +365,8 @@ gspell_navigator_gtv_goto_next (GspellNavigator *navigator,
word_start = word_end;
}
+ no_spell_check_tag = _gspell_utils_get_no_spell_check_tag (priv->buffer);
+
while (TRUE)
{
GtkTextIter word_end;
@@ -387,7 +390,7 @@ gspell_navigator_gtv_goto_next (GspellNavigator *navigator,
gtk_text_iter_backward_word_start (&word_start);
}
- if (!_gspell_utils_skip_no_spell_check (&word_start, &end))
+ if (!_gspell_utils_skip_no_spell_check (no_spell_check_tag, &word_start, &end))
{
return FALSE;
}
diff --git a/gspell/gspell-utils.c b/gspell/gspell-utils.c
index adb73ac..4505a52 100644
--- a/gspell/gspell-utils.c
+++ b/gspell/gspell-utils.c
@@ -67,23 +67,20 @@ _gspell_utils_get_no_spell_check_tag (GtkTextBuffer *buffer)
}
gboolean
-_gspell_utils_skip_no_spell_check (GtkTextIter *start,
+_gspell_utils_skip_no_spell_check (GtkTextTag *no_spell_check_tag,
+ GtkTextIter *start,
const GtkTextIter *end)
{
- GtkTextBuffer *buffer;
- GtkTextTag *no_spell_check_tag;
-
g_return_val_if_fail (start != NULL, FALSE);
g_return_val_if_fail (end != NULL, FALSE);
- buffer = gtk_text_iter_get_buffer (start);
- no_spell_check_tag = _gspell_utils_get_no_spell_check_tag (buffer);
-
if (no_spell_check_tag == NULL)
{
return TRUE;
}
+ g_return_val_if_fail (GTK_IS_TEXT_TAG (no_spell_check_tag), FALSE);
+
while (gtk_text_iter_has_tag (start, no_spell_check_tag))
{
GtkTextIter last = *start;
diff --git a/gspell/gspell-utils.h b/gspell/gspell-utils.h
index 7d9e051..0dc813a 100644
--- a/gspell/gspell-utils.h
+++ b/gspell/gspell-utils.h
@@ -33,7 +33,8 @@ G_GNUC_INTERNAL
GtkTextTag * _gspell_utils_get_no_spell_check_tag (GtkTextBuffer *buffer);
G_GNUC_INTERNAL
-gboolean _gspell_utils_skip_no_spell_check (GtkTextIter *start,
+gboolean _gspell_utils_skip_no_spell_check (GtkTextTag *no_spell_check_tag,
+ GtkTextIter *start,
const GtkTextIter *end);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]