1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00
This commit is contained in:
Geert Hauwaerts 2014-07-02 22:26:46 +02:00
commit 712ef12542
3 changed files with 22 additions and 7 deletions

View File

@ -1,4 +1,4 @@
ACLOCAL_AMFLAGS = -I m4
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
# create default-config.h
BUILT_SOURCES = default-config.h default-theme.h irssi-version.h
@ -27,8 +27,7 @@ pkginclude_HEADERS = irssi-config.h irssi-version.h
EXTRA_DIST = \
ChangeLog \
autogen.sh \
curses.m4 \
README \
README.md \
file2header.sh \
$(conf_DATA) \
$(theme_DATA) \

View File

@ -293,10 +293,24 @@ static void ignore_remove_config(IGNORE_REC *rec)
static void ignore_init_rec(IGNORE_REC *rec)
{
#ifdef HAVE_REGEX_H
char *errbuf;
int errcode, errbuf_len;
if (rec->regexp_compiled) regfree(&rec->preg);
rec->regexp_compiled = !rec->regexp || rec->pattern == NULL ? FALSE :
regcomp(&rec->preg, rec->pattern,
REG_EXTENDED|REG_ICASE|REG_NOSUB) == 0;
rec->regexp_compiled = FALSE;
if (rec->regexp && rec->pattern != NULL) {
errcode = regcomp(&rec->preg, rec->pattern,
REG_EXTENDED|REG_ICASE|REG_NOSUB);
if (errcode != 0) {
errbuf_len = regerror(errcode, &rec->preg, 0, 0);
errbuf = g_malloc(errbuf_len);
regerror(errcode, &rec->preg, errbuf, errbuf_len);
g_warning("Failed to compile regexp '%s': %s", rec->pattern, errbuf);
g_free(errbuf);
} else {
rec->regexp_compiled = TRUE;
}
}
#endif
}

View File

@ -56,8 +56,10 @@ static void ignore_print(int index, IGNORE_REC *rec)
if (rec->exception) g_string_append(options, "-except ");
if (rec->regexp) {
g_string_append(options, "-regexp ");
if (rec->pattern == NULL)
g_string_append(options, "[INVALID! -pattern missing] ");
#ifdef HAVE_REGEX_H
if (!rec->regexp_compiled)
else if (!rec->regexp_compiled)
g_string_append(options, "[INVALID!] ");
#endif
}