|
|
|
@ -95,7 +95,14 @@ append(cfg_t *cfg, const char *pattern) {
|
|
|
|
|
if ((regex = calloc(1, sizeof(rx_t))) == NULL) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
if ((ret = regcomp(®ex->regex, buf, flags)) == 0) { |
|
|
|
|
if ((ret = regcomp(®ex->regex, buf, flags)) != 0) { |
|
|
|
|
char buf[256] = ""; |
|
|
|
|
regerror(ret, ®ex->regex, buf, sizeof(buf)); |
|
|
|
|
log_msg(cfg, error, "regex compile error: %s", buf); |
|
|
|
|
free(regex); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
regex->score = cfg->defscore; |
|
|
|
|
regex->ftag = fnv_32a_str(pattern, FNV1_32A_INIT); |
|
|
|
|
strlcpy(regex->pattern, pattern, sizeof(regex->pattern)); |
|
|
|
@ -108,14 +115,6 @@ append(cfg_t *cfg, const char *pattern) {
|
|
|
|
|
cfg->rlast = regex; |
|
|
|
|
cfg->flags |= MOD_IS_READY; |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
char buf[256] = ""; |
|
|
|
|
regerror(ret, ®ex->regex, buf, sizeof(buf)); |
|
|
|
|
log_msg(cfg, error, "regex compile error: %s", buf); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
free(regex); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint32_t |
|
|
|
|