[balsa] Streamline code
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Streamline code
- Date: Sat, 8 Apr 2017 23:44:24 +0000 (UTC)
commit 7c9a7964d5e990c1ce20dbf13bb39ebe5cd80b86
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Apr 8 19:42:29 2017 -0400
Streamline code
* src/spell-check.c: remove redundant gboolean
quoted_rex_compiled;
(balsa_spell_check_start): do not use it;
(next_word): ditto;
(balsa_spell_check_destroy): ditto; also use g_clear_pointer.
ChangeLog | 10 ++++++++++
src/spell-check.c | 22 ++++++----------------
2 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 64b42e3..ff86643 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-04-08 Peter Bloomfield <pbloomfield bellsouth net>
+
+Streamline code
+
+ * src/spell-check.c: remove redundant gboolean
+ quoted_rex_compiled;
+ (balsa_spell_check_start): do not use it;
+ (next_word): ditto;
+ (balsa_spell_check_destroy): ditto; also use g_clear_pointer.
+
2017-04-07 Peter Bloomfield <pbloomfield bellsouth net>
* src/balsa-message.c (select_part): reset adjustments only when
diff --git a/src/spell-check.c b/src/spell-check.c
index 8c0d116..d85ac14 100644
--- a/src/spell-check.c
+++ b/src/spell-check.c
@@ -541,8 +541,7 @@ done_cb(GtkButton * button, gpointer data)
* dictionary to do the checking.
* */
-static GRegex *quoted_rex;
-static gboolean quoted_rex_compiled = FALSE;
+static GRegex *quoted_rex = NULL;
void
balsa_spell_check_start(BalsaSpellCheck * spell_check)
@@ -617,13 +616,9 @@ balsa_spell_check_start(BalsaSpellCheck * spell_check)
* balsa_app.quote_regex may change, so compile it new every
* time!)
*/
- if (quoted_rex_compiled)
+ if (quoted_rex != NULL)
g_regex_unref(quoted_rex);
quoted_rex = balsa_quote_regex_new();
- if (!quoted_rex)
- quoted_rex_compiled = FALSE;
- else
- quoted_rex_compiled = TRUE;
spell_check->end_iter = start;
@@ -832,18 +827,13 @@ balsa_spell_check_destroy(GObject * object)
spch_finish(spell_check, FALSE);
}
- g_free(spell_check->language_tag);
- spell_check->language_tag = NULL;
-
if (spell_check->highlight_idle_id) {
g_source_remove(spell_check->highlight_idle_id);
spell_check->highlight_idle_id = 0;
}
- if (quoted_rex_compiled) {
- g_regex_unref(quoted_rex);
- quoted_rex_compiled = FALSE;
- }
+ g_clear_pointer(&spell_check->language_tag, g_free);
+ g_clear_pointer("ed_rex, g_regex_unref);
if (G_OBJECT_CLASS(balsa_spell_check_parent_class)->dispose)
(*G_OBJECT_CLASS(balsa_spell_check_parent_class)->
@@ -1077,8 +1067,8 @@ next_word(BalsaSpellCheck * spell_check)
&line_end, FALSE);
skip_sig = (!balsa_app.check_sig
&& strcmp(line, "-- \n") == 0);
- skip_quoted = (!balsa_app.check_quoted && quoted_rex_compiled
- && is_a_quote(line, quoted_rex));
+ skip_quoted = (!balsa_app.check_quoted && quoted_rex != NULL
+ && is_a_quote(line, quoted_rex) > 0);
g_free(line);
if (skip_sig)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]