summaryrefslogtreecommitdiff
path: root/src/core/ignore.c
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2016-01-29 16:22:14 +0100
committerAilin Nemui <ailin@z30a.localdomain>2017-01-02 17:50:14 +0100
commit3fcd3cd2b9fae07a0b7cd3e5ba91049f19cc6501 (patch)
tree2f8cc52b98a0cc43acf7f4887984d70000a12e3e /src/core/ignore.c
parentb5a727c87cf7db944ade9c6714385f1e8598d37e (diff)
downloadirssi-3fcd3cd2b9fae07a0b7cd3e5ba91049f19cc6501.zip
Remove the regexp_compiled field.
It was made redundant by the introduction of the pointer to the GRegex structure. Silence the compiler warning in textbuffer.c about preg being initialized by setting it to NULL.
Diffstat (limited to 'src/core/ignore.c')
-rw-r--r--src/core/ignore.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/core/ignore.c b/src/core/ignore.c
index 2b8299bd..30cb7cb8 100644
--- a/src/core/ignore.c
+++ b/src/core/ignore.c
@@ -66,10 +66,8 @@ static int ignore_match_pattern(IGNORE_REC *rec, const char *text)
if (text == NULL)
return FALSE;
- if (rec->regexp) {
- return rec->regexp_compiled &&
- g_regex_match(rec->preg, text, 0, NULL);
- }
+ if (rec->regexp)
+ return rec->preg && g_regex_match(rec->preg, text, 0, NULL);
return rec->fullword ?
stristr_full(text, rec->pattern) != NULL :
@@ -322,10 +320,8 @@ static void ignore_remove_config(IGNORE_REC *rec)
static void ignore_init_rec(IGNORE_REC *rec)
{
- if (rec->regexp_compiled) {
+ if (rec->preg != NULL)
g_regex_unref(rec->preg);
- rec->regexp_compiled = FALSE;
- }
if (rec->regexp && rec->pattern != NULL) {
GError *re_error;
@@ -335,8 +331,6 @@ static void ignore_init_rec(IGNORE_REC *rec)
if (rec->preg == NULL) {
g_warning("Failed to compile regexp '%s': %s", rec->pattern, re_error->message);
g_error_free(re_error);
- } else {
- rec->regexp_compiled = TRUE;
}
}
}
@@ -358,7 +352,7 @@ static void ignore_destroy(IGNORE_REC *rec, int send_signal)
if (send_signal)
signal_emit("ignore destroyed", 1, rec);
- if (rec->regexp_compiled) g_regex_unref(rec->preg);
+ if (rec->preg != NULL) g_regex_unref(rec->preg);
if (rec->channels != NULL) g_strfreev(rec->channels);
g_free_not_null(rec->mask);
g_free_not_null(rec->servertag);