diff options
author | LemonBoy <thatlemon@gmail.com> | 2016-01-29 16:22:14 +0100 |
---|---|---|
committer | Ailin Nemui <ailin@z30a.localdomain> | 2017-01-02 17:50:14 +0100 |
commit | 3fcd3cd2b9fae07a0b7cd3e5ba91049f19cc6501 (patch) | |
tree | 2f8cc52b98a0cc43acf7f4887984d70000a12e3e /src/fe-common | |
parent | b5a727c87cf7db944ade9c6714385f1e8598d37e (diff) | |
download | irssi-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/fe-common')
-rw-r--r-- | src/fe-common/core/fe-ignore.c | 2 | ||||
-rw-r--r-- | src/fe-common/core/hilight-text.c | 13 | ||||
-rw-r--r-- | src/fe-common/core/hilight-text.h | 1 |
3 files changed, 5 insertions, 11 deletions
diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c index addfa0b8..03fd4dd2 100644 --- a/src/fe-common/core/fe-ignore.c +++ b/src/fe-common/core/fe-ignore.c @@ -58,7 +58,7 @@ static void ignore_print(int index, IGNORE_REC *rec) g_string_append(options, "-regexp "); if (rec->pattern == NULL) g_string_append(options, "[INVALID! -pattern missing] "); - else if (!rec->regexp_compiled) + else if (rec->preg == NULL) g_string_append(options, "[INVALID!] "); } if (rec->fullword) g_string_append(options, "-full "); diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 83b6f67e..e3dcc2d9 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -101,7 +101,7 @@ static void hilight_destroy(HILIGHT_REC *rec) { g_return_if_fail(rec != NULL); - 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->color); g_free_not_null(rec->act_color); @@ -118,15 +118,10 @@ static void hilights_destroy_all(void) static void hilight_init_rec(HILIGHT_REC *rec) { - if (rec->regexp_compiled) { + if (rec->preg != NULL) g_regex_unref(rec->preg); - rec->regexp_compiled = FALSE; - } rec->preg = g_regex_new(rec->text, G_REGEX_CASELESS, 0, NULL); - - if (rec->preg != NULL) - rec->regexp_compiled = TRUE; } void hilight_create(HILIGHT_REC *rec) @@ -201,7 +196,7 @@ static int hilight_match_text(HILIGHT_REC *rec, const char *text, if (rec->regexp) { GMatchInfo *match; - if (rec->regexp_compiled) { + if (rec->preg != NULL) { g_regex_match (rec->preg, text, 0, &match); if (g_match_info_matches(match)) { @@ -504,7 +499,7 @@ static void hilight_print(int index, HILIGHT_REC *rec) if (rec->case_sensitive) g_string_append(options, "-matchcase "); if (rec->regexp) { g_string_append(options, "-regexp "); - if (!rec->regexp_compiled) + if (rec->preg == NULL) g_string_append(options, "[INVALID!] "); } diff --git a/src/fe-common/core/hilight-text.h b/src/fe-common/core/hilight-text.h index a74c38b0..93c573c2 100644 --- a/src/fe-common/core/hilight-text.h +++ b/src/fe-common/core/hilight-text.h @@ -20,7 +20,6 @@ struct _HILIGHT_REC { unsigned int fullword:1; /* match `text' only for full words */ unsigned int regexp:1; /* `text' is a regular expression */ unsigned int case_sensitive:1;/* `text' must match case */ - unsigned int regexp_compiled:1; /* should always be TRUE, unless regexp is invalid */ GRegex *preg; char *servertag; }; |