mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Warn with error if regexp ignore fails to parse
This commit is contained in:
parent
2b6bba3fd2
commit
0086211236
@ -293,10 +293,24 @@ static void ignore_remove_config(IGNORE_REC *rec)
|
|||||||
static void ignore_init_rec(IGNORE_REC *rec)
|
static void ignore_init_rec(IGNORE_REC *rec)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
|
char *errbuf;
|
||||||
|
int errcode, errbuf_len;
|
||||||
|
|
||||||
if (rec->regexp_compiled) regfree(&rec->preg);
|
if (rec->regexp_compiled) regfree(&rec->preg);
|
||||||
rec->regexp_compiled = !rec->regexp || rec->pattern == NULL ? FALSE :
|
rec->regexp_compiled = FALSE;
|
||||||
regcomp(&rec->preg, rec->pattern,
|
if (rec->regexp && rec->pattern != NULL) {
|
||||||
REG_EXTENDED|REG_ICASE|REG_NOSUB) == 0;
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user