MXS-875: Fix regexfilter matching
The return values of pcre2_match are now properly handled. A positive match is a return value which is greater than or equal to zero. This fix should give a small performance boost to as memory is no longer needlessly allocated.
This commit is contained in:
parent
542666ed16
commit
e618370cdb
@ -482,7 +482,7 @@ regex_replace(const char *sql, pcre2_code *re, pcre2_match_data *match_data, con
|
||||
size_t result_size;
|
||||
|
||||
/** This should never fail with rc == 0 because we used pcre2_match_data_create_from_pattern() */
|
||||
if (pcre2_match(re, (PCRE2_SPTR) sql, PCRE2_ZERO_TERMINATED, 0, 0, match_data, NULL))
|
||||
if (pcre2_match(re, (PCRE2_SPTR) sql, PCRE2_ZERO_TERMINATED, 0, 0, match_data, NULL) > 0)
|
||||
{
|
||||
result_size = strlen(sql) + strlen(replace);
|
||||
result = malloc(result_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user