diff options
author | Geert Hauwaerts <geert@hauwaerts.be> | 2014-07-02 22:26:46 +0200 |
---|---|---|
committer | Geert Hauwaerts <geert@hauwaerts.be> | 2014-07-02 22:26:46 +0200 |
commit | 712ef12542a2847a8ab1d6648735f7b5c963a6ed (patch) | |
tree | aff5d59d01843725aa5a7ff88c6f03640e72e4fc | |
parent | b2f265f44ecd4eaea1eeb1a90cfdf26dc58218ae (diff) | |
parent | aa7492d0991d32f2d64c6ce959ceb46aec7aafbd (diff) | |
download | irssi-712ef12542a2847a8ab1d6648735f7b5c963a6ed.zip |
Merge branch 'master' of https://github.com/irssi/irssi
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | src/core/ignore.c | 20 | ||||
-rw-r--r-- | src/fe-common/core/fe-ignore.c | 4 |
3 files changed, 22 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am index 5bb0a2d7..4f1d1112 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) \ diff --git a/src/core/ignore.c b/src/core/ignore.c index a7aa106f..eda232c7 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -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 } diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c index 7c23ad94..6d53bf1b 100644 --- a/src/fe-common/core/fe-ignore.c +++ b/src/fe-common/core/fe-ignore.c @@ -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 } |