mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
regexec() can only return zero or NOMATCH according to its man page. This allows us to remove the error handler as it could never be executed.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
+2
-6
@@ -72,6 +72,8 @@ bool match_regex(const char *input, const unsigned char regexid)
|
||||
|
||||
// Try to match the compiled regular expression against input
|
||||
int errcode = regexec(®ex[regexid][index], input, 0, NULL, 0);
|
||||
// regexec() returns zero for a successful match or REG_NOMATCH for failure.
|
||||
// We are only interested in the matching case here.
|
||||
if (errcode == 0)
|
||||
{
|
||||
// Match, return true
|
||||
@@ -82,12 +84,6 @@ bool match_regex(const char *input, const unsigned char regexid)
|
||||
logg("Regex %s in line %i \"%s\" matches \"%s\"", regextype[regexid], index+1, regexbuffer[regexid][index], input);
|
||||
break;
|
||||
}
|
||||
else if (errcode != REG_NOMATCH)
|
||||
{
|
||||
// Error, return false afterwards
|
||||
log_regex_error("matching", errcode, index, regexid, "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double elapsed = timer_elapsed_msec(REGEX_TIMER);
|
||||
|
||||
Reference in New Issue
Block a user