[v3,09/21] Use regex::match wrapper instead of regexec.
Commit Message
This patch eliminates all calls to regexec except that by regex::match
itself.
There are no behavioural changes.
* src/abg-corpus-priv.h: Mechanically substitute use of
regexec with regex::match wrapper.
* src/abg-suppression-priv.h: Ditto.
* src/abg-suppression.cc: Ditto.
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
src/abg-corpus-priv.h | 8 +--
src/abg-suppression-priv.h | 10 ++--
src/abg-suppression.cc | 119 +++++++++++--------------------------
3 files changed, 44 insertions(+), 93 deletions(-)
Comments
On Fri, Apr 24, 2020 at 10:21:20AM +0100, Giuliano Procida wrote:
>This patch eliminates all calls to regexec except that by regex::match
>itself.
>
>There are no behavioural changes.
>
> * src/abg-corpus-priv.h: Mechanically substitute use of
> regexec with regex::match wrapper.
> * src/abg-suppression-priv.h: Ditto.
> * src/abg-suppression.cc: Ditto.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>
Reviewed-by: Matthias Maennich <maennich@google.com>
Cheers,
Matthias
>---
> src/abg-corpus-priv.h | 8 +--
> src/abg-suppression-priv.h | 10 ++--
> src/abg-suppression.cc | 119 +++++++++++--------------------------
> 3 files changed, 44 insertions(+), 93 deletions(-)
>
>diff --git a/src/abg-corpus-priv.h b/src/abg-corpus-priv.h
>index 544fac54..2618e2d0 100644
>--- a/src/abg-corpus-priv.h
>+++ b/src/abg-corpus-priv.h
>@@ -521,7 +521,7 @@ public:
> compiled_regex_fns_suppress().begin();
> i != compiled_regex_fns_suppress().end();
> ++i)
>- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(*i, frep))
> {
> keep = false;
> break;
>@@ -554,7 +554,7 @@ public:
> compiled_regex_fns_keep().begin();
> i != compiled_regex_fns_keep().end();
> ++i)
>- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(*i, frep))
> {
> keep = true;
> break;
>@@ -628,7 +628,7 @@ public:
> compiled_regex_vars_suppress().begin();
> i != compiled_regex_vars_suppress().end();
> ++i)
>- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(*i, frep))
> {
> keep = false;
> break;
>@@ -662,7 +662,7 @@ public:
> compiled_regex_vars_keep().begin();
> i != compiled_regex_vars_keep().end();
> ++i)
>- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(*i, frep))
> {
> keep = true;
> break;
>diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h
>index 4959cdbb..8043ebd9 100644
>--- a/src/abg-suppression-priv.h
>+++ b/src/abg-suppression-priv.h
>@@ -160,14 +160,14 @@ public:
> if (regex::regex_t_sptr regexp = get_soname_regex())
> {
> has_regexp = true;
>- if (regexec(regexp.get(), soname.c_str(), 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, soname))
> return false;
> }
>
> if (regex::regex_t_sptr regexp = get_soname_not_regex())
> {
> has_regexp = true;
>- if (regexec(regexp.get(), soname.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(regexp, soname))
> return false;
> }
>
>@@ -195,16 +195,14 @@ public:
> if (regex::regex_t_sptr regexp = get_file_name_regex())
> {
> has_regexp = true;
>- if (regexec(regexp.get(), binary_name.c_str(),
>- 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, binary_name))
> return false;
> }
>
> if (regex::regex_t_sptr regexp = get_file_name_not_regex())
> {
> has_regexp = true;
>- if (regexec(regexp.get(), binary_name.c_str(),
>- 0, NULL, 0) == 0)
>+ if (regex::match(regexp, binary_name))
> return false;
> }
>
>diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
>index 831a61ef..73e422a3 100644
>--- a/src/abg-suppression.cc
>+++ b/src/abg-suppression.cc
>@@ -994,18 +994,14 @@ suppression_matches_type_name(const type_suppression& s,
> if (const regex_t_sptr& type_name_regex =
> s.priv_->get_type_name_regex())
> {
>- if (regexec(type_name_regex.get(),
>- type_name.c_str(),
>- 0, NULL, 0) != 0)
>+ if (!regex::match(type_name_regex, type_name))
> return false;
> }
>
> if (const regex_t_sptr type_name_not_regex =
> s.priv_->get_type_name_not_regex())
> {
>- if (regexec(type_name_not_regex.get(),
>- type_name.c_str(),
>- 0, NULL, 0) == 0)
>+ if (regex::match(type_name_not_regex, type_name))
> return false;
> }
> }
>@@ -1052,7 +1048,7 @@ suppression_matches_type_location(const type_suppression& s,
> loc.expand(loc_path, loc_line, loc_column);
>
> if (regex_t_sptr regexp = s.priv_->get_source_location_to_keep_regex())
>- if (regexec(regexp.get(), loc_path.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(regexp, loc_path))
> return false;
>
> tools_utils::base_name(loc_path, loc_path_base);
>@@ -2489,9 +2485,7 @@ function_suppression::suppresses_function(const function_decl* fn,
> const regex_t_sptr name_regex = priv_->get_name_regex();
> if (name_regex)
> {
>- if (regexec(name_regex.get(),
>- fname.c_str(),
>- 0, NULL, 0) != 0)
>+ if (!regex::match(name_regex, fname))
> return false;
>
> if (get_allow_other_aliases()
>@@ -2512,9 +2506,7 @@ function_suppression::suppresses_function(const function_decl* fn,
> for (elf_symbol_sptr a = sym->get_next_alias();
> a && !a->is_main_symbol();
> a = a->get_next_alias())
>- if (regexec(name_regex.get(),
>- a->get_name().c_str(),
>- 0, NULL, 0) != 0)
>+ if (!regex::match(name_regex, a->get_name()))
> return false;
> }
> }
>@@ -2524,9 +2516,7 @@ function_suppression::suppresses_function(const function_decl* fn,
> const regex_t_sptr name_not_regex = priv_->get_name_not_regex();
> if (name_not_regex)
> {
>- if (regexec(name_not_regex.get(),
>- fname.c_str(),
>- 0, NULL, 0) == 0)
>+ if (regex::match(name_not_regex, fname))
> return false;
>
> if (get_allow_other_aliases()
>@@ -2547,9 +2537,7 @@ function_suppression::suppresses_function(const function_decl* fn,
> for (elf_symbol_sptr a = sym->get_next_alias();
> a && !a->is_main_symbol();
> a = a->get_next_alias())
>- if (regexec(name_regex.get(),
>- a->get_name().c_str(),
>- 0, NULL, 0) == 0)
>+ if (regex::match(name_regex, a->get_name()))
> return false;
> }
> }
>@@ -2573,9 +2561,7 @@ function_suppression::suppresses_function(const function_decl* fn,
> {
> const regex_t_sptr return_type_regex = priv_->get_return_type_regex();
> if (return_type_regex
>- && (regexec(return_type_regex.get(),
>- fn_return_type_name.c_str(),
>- 0, NULL, 0) != 0))
>+ && !regex::match(return_type_regex, fn_return_type_name))
> return false;
> }
>
>@@ -2612,18 +2598,13 @@ function_suppression::suppresses_function(const function_decl* fn,
> else if (sym)
> {
> const regex_t_sptr symbol_name_regex = priv_->get_symbol_name_regex();
>- if (symbol_name_regex
>- && (regexec(symbol_name_regex.get(),
>- fn_sym_name.c_str(),
>- 0, NULL, 0) != 0))
>+ if (symbol_name_regex && !regex::match(symbol_name_regex, fn_sym_name))
> return false;
>
> const regex_t_sptr symbol_name_not_regex =
> priv_->get_symbol_name_not_regex();
> if (symbol_name_not_regex
>- && (regexec(symbol_name_not_regex.get(),
>- fn_sym_name.c_str(),
>- 0, NULL, 0) == 0))
>+ && regex::match(symbol_name_not_regex, fn_sym_name))
> return false;
>
> if (get_allow_other_aliases())
>@@ -2638,15 +2619,11 @@ function_suppression::suppresses_function(const function_decl* fn,
> a = a->get_next_alias())
> {
> if (symbol_name_regex
>- && (regexec(symbol_name_regex.get(),
>- a->get_name().c_str(),
>- 0, NULL, 0) != 0))
>+ && !regex::match(symbol_name_regex, a->get_name()))
> return false;
>
> if (symbol_name_not_regex
>- && (regexec(symbol_name_not_regex.get(),
>- a->get_name().c_str(),
>- 0, NULL, 0) == 0))
>+ && regex::match(symbol_name_not_regex, a->get_name()))
> return false;
> }
> }
>@@ -2665,9 +2642,7 @@ function_suppression::suppresses_function(const function_decl* fn,
> const regex_t_sptr symbol_version_regex =
> priv_->get_symbol_version_regex();
> if (symbol_version_regex
>- && (regexec(symbol_version_regex.get(),
>- fn_sym_version.c_str(),
>- 0, NULL, 0) != 0))
>+ && !regex::match(symbol_version_regex, fn_sym_version))
> return false;
> }
>
>@@ -2708,9 +2683,8 @@ function_suppression::suppresses_function(const function_decl* fn,
> (*p)->priv_->get_type_name_regex();
> if (parm_type_name_regex)
> {
>- if ((regexec(parm_type_name_regex.get(),
>- fn_parm_type_qualified_name.c_str(),
>- 0, NULL, 0) != 0))
>+ if (!regex::match(parm_type_name_regex,
>+ fn_parm_type_qualified_name))
> return false;
> }
> }
>@@ -2798,10 +2772,7 @@ function_suppression::suppresses_function_symbol(const elf_symbol* sym,
> else if (!get_symbol_name_regex_str().empty())
> {
> const regex_t_sptr symbol_name_regex = priv_->get_symbol_name_regex();
>- if (symbol_name_regex
>- && (regexec(symbol_name_regex.get(),
>- sym_name.c_str(),
>- 0, NULL, 0) != 0))
>+ if (symbol_name_regex && !regex::match(symbol_name_regex, sym_name))
> return false;
> }
> else
>@@ -2818,9 +2789,7 @@ function_suppression::suppresses_function_symbol(const elf_symbol* sym,
> const regex_t_sptr symbol_version_regex =
> priv_->get_symbol_version_regex();
> if (symbol_version_regex
>- && (regexec(symbol_version_regex.get(),
>- sym_version.c_str(),
>- 0, NULL, 0) != 0))
>+ && !regex::match(symbol_version_regex, sym_version))
> return false;
> }
> else
>@@ -2912,12 +2881,12 @@ suppression_matches_function_name(const suppr::function_suppression& s,
> {
> if (regex_t_sptr regexp = s.priv_->get_name_regex())
> {
>- if (regexec(regexp.get(), fn_name.c_str(), 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, fn_name))
> return false;
> }
> else if (regex_t_sptr regexp = s.priv_->get_name_not_regex())
> {
>- if (regexec(regexp.get(), fn_name.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(regexp, fn_name))
> return false;
> }
> else if (s.priv_->name_.empty())
>@@ -2948,12 +2917,12 @@ suppression_matches_function_sym_name(const suppr::function_suppression& s,
> {
> if (regex_t_sptr regexp = s.priv_->get_symbol_name_regex())
> {
>- if (regexec(regexp.get(), fn_linkage_name.c_str(), 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, fn_linkage_name))
> return false;
> }
> else if (regex_t_sptr regexp = s.priv_->get_symbol_name_not_regex())
> {
>- if (regexec(regexp.get(), fn_linkage_name.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(regexp, fn_linkage_name))
> return false;
> }
> else if (s.priv_->symbol_name_.empty())
>@@ -2981,12 +2950,12 @@ suppression_matches_variable_name(const suppr::variable_suppression& s,
> {
> if (regex_t_sptr regexp = s.priv_->get_name_regex())
> {
>- if (regexec(regexp.get(), var_name.c_str(), 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, var_name))
> return false;
> }
> else if (regex_t_sptr regexp = s.priv_->get_name_not_regex())
> {
>- if (regexec(regexp.get(), var_name.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(regexp, var_name))
> return false;
> }
> else if (s.priv_->name_.empty())
>@@ -3015,13 +2984,13 @@ suppression_matches_variable_sym_name(const suppr::variable_suppression& s,
> {
> if (regex_t_sptr regexp = s.priv_->get_symbol_name_regex())
> {
>- if (regexec(regexp.get(), var_linkage_name.c_str(), 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, var_linkage_name))
> return false;
> }
> else if (regex_t_sptr regexp =
> s.priv_->get_symbol_name_not_regex())
> {
>- if (regexec(regexp.get(), var_linkage_name.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(regexp, var_linkage_name))
> return false;
> }
> else if (s.priv_->symbol_name_.empty())
>@@ -3050,7 +3019,7 @@ suppression_matches_type(const suppr::type_suppression& s,
> {
> if (regex_t_sptr regexp = s.priv_->get_type_name_regex())
> {
>- if (regexec(regexp.get(), type_name.c_str(), 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, type_name))
> return false;
> }
> else if (!s.get_type_name().empty())
>@@ -3748,15 +3717,11 @@ variable_suppression::suppresses_variable(const var_decl* var,
> if (get_name().empty())
> {
> const regex_t_sptr name_regex = priv_->get_name_regex();
>- if (name_regex
>- && (regexec(name_regex.get(), var_name.c_str(),
>- 0, NULL, 0) != 0))
>+ if (name_regex && !regex::match(name_regex, var_name))
> return false;
>
> const regex_t_sptr name_not_regex = priv_->get_name_not_regex();
>- if (name_not_regex
>- && (regexec(name_not_regex.get(), var_name.c_str(),
>- 0, NULL, 0) == 0))
>+ if (name_not_regex && regex::match(name_not_regex, var_name))
> return false;
> }
> }
>@@ -3772,16 +3737,12 @@ variable_suppression::suppresses_variable(const var_decl* var,
> else
> {
> const regex_t_sptr sym_name_regex = priv_->get_symbol_name_regex();
>- if (sym_name_regex
>- && (regexec(sym_name_regex.get(), var_sym_name.c_str(),
>- 0, NULL, 0) != 0))
>+ if (sym_name_regex && !regex::match(sym_name_regex, var_sym_name))
> return false;
>
> const regex_t_sptr sym_name_not_regex =
> priv_->get_symbol_name_not_regex();
>- if (sym_name_not_regex
>- && (regexec(sym_name_not_regex.get(), var_sym_name.c_str(),
>- 0, NULL, 0) == 0))
>+ if (sym_name_not_regex && regex::match(sym_name_not_regex, var_sym_name))
> return false;
> }
>
>@@ -3798,9 +3759,7 @@ variable_suppression::suppresses_variable(const var_decl* var,
> const regex_t_sptr symbol_version_regex =
> priv_->get_symbol_version_regex();
> if (symbol_version_regex
>- && (regexec(symbol_version_regex.get(),
>- var_sym_version.c_str(),
>- 0, NULL, 0) != 0))
>+ && !regex::match(symbol_version_regex, var_sym_version))
> return false;
> }
>
>@@ -3818,9 +3777,7 @@ variable_suppression::suppresses_variable(const var_decl* var,
> if (get_type_name().empty())
> {
> const regex_t_sptr type_name_regex = priv_->get_type_name_regex();
>- if (type_name_regex
>- && (regexec(type_name_regex.get(), var_type_name.c_str(),
>- 0, NULL, 0) != 0))
>+ if (type_name_regex && !regex::match(type_name_regex, var_type_name))
> return false;
> }
> }
>@@ -3911,9 +3868,7 @@ variable_suppression::suppresses_variable_symbol(const elf_symbol* sym,
> else if (!get_symbol_name_regex_str().empty())
> {
> const regex_t_sptr sym_name_regex = priv_->get_symbol_name_regex();
>- if (sym_name_regex
>- && (regexec(sym_name_regex.get(), sym_name.c_str(),
>- 0, NULL, 0) != 0))
>+ if (sym_name_regex && !regex::match(sym_name_regex, sym_name))
> return false;
> }
> else
>@@ -3931,9 +3886,7 @@ variable_suppression::suppresses_variable_symbol(const elf_symbol* sym,
> const regex_t_sptr symbol_version_regex =
> priv_->get_symbol_version_regex();
> if (symbol_version_regex
>- && (regexec(symbol_version_regex.get(),
>- sym_version.c_str(),
>- 0, NULL, 0) != 0))
>+ && !regex::match(symbol_version_regex, sym_version))
> return false;
> }
> else
>@@ -4229,14 +4182,14 @@ file_suppression::suppresses_file(const string& file_path)
> if (regex_t_sptr regexp = suppression_base::priv_->get_file_name_regex())
> {
> has_regexp = true;
>- if (regexec(regexp.get(), fname.c_str(), 0, NULL, 0) != 0)
>+ if (!regex::match(regexp, fname))
> return false;
> }
>
> if (regex_t_sptr regexp = suppression_base::priv_->get_file_name_not_regex())
> {
> has_regexp = true;
>- if (regexec(regexp.get(), fname.c_str(), 0, NULL, 0) == 0)
>+ if (regex::match(regexp, fname))
> return false;
> }
>
>--
>2.26.2.303.gf8c07b1a785-goog
>
@@ -521,7 +521,7 @@ public:
compiled_regex_fns_suppress().begin();
i != compiled_regex_fns_suppress().end();
++i)
- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(*i, frep))
{
keep = false;
break;
@@ -554,7 +554,7 @@ public:
compiled_regex_fns_keep().begin();
i != compiled_regex_fns_keep().end();
++i)
- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(*i, frep))
{
keep = true;
break;
@@ -628,7 +628,7 @@ public:
compiled_regex_vars_suppress().begin();
i != compiled_regex_vars_suppress().end();
++i)
- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(*i, frep))
{
keep = false;
break;
@@ -662,7 +662,7 @@ public:
compiled_regex_vars_keep().begin();
i != compiled_regex_vars_keep().end();
++i)
- if (regexec(i->get(), frep.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(*i, frep))
{
keep = true;
break;
@@ -160,14 +160,14 @@ public:
if (regex::regex_t_sptr regexp = get_soname_regex())
{
has_regexp = true;
- if (regexec(regexp.get(), soname.c_str(), 0, NULL, 0) != 0)
+ if (!regex::match(regexp, soname))
return false;
}
if (regex::regex_t_sptr regexp = get_soname_not_regex())
{
has_regexp = true;
- if (regexec(regexp.get(), soname.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(regexp, soname))
return false;
}
@@ -195,16 +195,14 @@ public:
if (regex::regex_t_sptr regexp = get_file_name_regex())
{
has_regexp = true;
- if (regexec(regexp.get(), binary_name.c_str(),
- 0, NULL, 0) != 0)
+ if (!regex::match(regexp, binary_name))
return false;
}
if (regex::regex_t_sptr regexp = get_file_name_not_regex())
{
has_regexp = true;
- if (regexec(regexp.get(), binary_name.c_str(),
- 0, NULL, 0) == 0)
+ if (regex::match(regexp, binary_name))
return false;
}
@@ -994,18 +994,14 @@ suppression_matches_type_name(const type_suppression& s,
if (const regex_t_sptr& type_name_regex =
s.priv_->get_type_name_regex())
{
- if (regexec(type_name_regex.get(),
- type_name.c_str(),
- 0, NULL, 0) != 0)
+ if (!regex::match(type_name_regex, type_name))
return false;
}
if (const regex_t_sptr type_name_not_regex =
s.priv_->get_type_name_not_regex())
{
- if (regexec(type_name_not_regex.get(),
- type_name.c_str(),
- 0, NULL, 0) == 0)
+ if (regex::match(type_name_not_regex, type_name))
return false;
}
}
@@ -1052,7 +1048,7 @@ suppression_matches_type_location(const type_suppression& s,
loc.expand(loc_path, loc_line, loc_column);
if (regex_t_sptr regexp = s.priv_->get_source_location_to_keep_regex())
- if (regexec(regexp.get(), loc_path.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(regexp, loc_path))
return false;
tools_utils::base_name(loc_path, loc_path_base);
@@ -2489,9 +2485,7 @@ function_suppression::suppresses_function(const function_decl* fn,
const regex_t_sptr name_regex = priv_->get_name_regex();
if (name_regex)
{
- if (regexec(name_regex.get(),
- fname.c_str(),
- 0, NULL, 0) != 0)
+ if (!regex::match(name_regex, fname))
return false;
if (get_allow_other_aliases()
@@ -2512,9 +2506,7 @@ function_suppression::suppresses_function(const function_decl* fn,
for (elf_symbol_sptr a = sym->get_next_alias();
a && !a->is_main_symbol();
a = a->get_next_alias())
- if (regexec(name_regex.get(),
- a->get_name().c_str(),
- 0, NULL, 0) != 0)
+ if (!regex::match(name_regex, a->get_name()))
return false;
}
}
@@ -2524,9 +2516,7 @@ function_suppression::suppresses_function(const function_decl* fn,
const regex_t_sptr name_not_regex = priv_->get_name_not_regex();
if (name_not_regex)
{
- if (regexec(name_not_regex.get(),
- fname.c_str(),
- 0, NULL, 0) == 0)
+ if (regex::match(name_not_regex, fname))
return false;
if (get_allow_other_aliases()
@@ -2547,9 +2537,7 @@ function_suppression::suppresses_function(const function_decl* fn,
for (elf_symbol_sptr a = sym->get_next_alias();
a && !a->is_main_symbol();
a = a->get_next_alias())
- if (regexec(name_regex.get(),
- a->get_name().c_str(),
- 0, NULL, 0) == 0)
+ if (regex::match(name_regex, a->get_name()))
return false;
}
}
@@ -2573,9 +2561,7 @@ function_suppression::suppresses_function(const function_decl* fn,
{
const regex_t_sptr return_type_regex = priv_->get_return_type_regex();
if (return_type_regex
- && (regexec(return_type_regex.get(),
- fn_return_type_name.c_str(),
- 0, NULL, 0) != 0))
+ && !regex::match(return_type_regex, fn_return_type_name))
return false;
}
@@ -2612,18 +2598,13 @@ function_suppression::suppresses_function(const function_decl* fn,
else if (sym)
{
const regex_t_sptr symbol_name_regex = priv_->get_symbol_name_regex();
- if (symbol_name_regex
- && (regexec(symbol_name_regex.get(),
- fn_sym_name.c_str(),
- 0, NULL, 0) != 0))
+ if (symbol_name_regex && !regex::match(symbol_name_regex, fn_sym_name))
return false;
const regex_t_sptr symbol_name_not_regex =
priv_->get_symbol_name_not_regex();
if (symbol_name_not_regex
- && (regexec(symbol_name_not_regex.get(),
- fn_sym_name.c_str(),
- 0, NULL, 0) == 0))
+ && regex::match(symbol_name_not_regex, fn_sym_name))
return false;
if (get_allow_other_aliases())
@@ -2638,15 +2619,11 @@ function_suppression::suppresses_function(const function_decl* fn,
a = a->get_next_alias())
{
if (symbol_name_regex
- && (regexec(symbol_name_regex.get(),
- a->get_name().c_str(),
- 0, NULL, 0) != 0))
+ && !regex::match(symbol_name_regex, a->get_name()))
return false;
if (symbol_name_not_regex
- && (regexec(symbol_name_not_regex.get(),
- a->get_name().c_str(),
- 0, NULL, 0) == 0))
+ && regex::match(symbol_name_not_regex, a->get_name()))
return false;
}
}
@@ -2665,9 +2642,7 @@ function_suppression::suppresses_function(const function_decl* fn,
const regex_t_sptr symbol_version_regex =
priv_->get_symbol_version_regex();
if (symbol_version_regex
- && (regexec(symbol_version_regex.get(),
- fn_sym_version.c_str(),
- 0, NULL, 0) != 0))
+ && !regex::match(symbol_version_regex, fn_sym_version))
return false;
}
@@ -2708,9 +2683,8 @@ function_suppression::suppresses_function(const function_decl* fn,
(*p)->priv_->get_type_name_regex();
if (parm_type_name_regex)
{
- if ((regexec(parm_type_name_regex.get(),
- fn_parm_type_qualified_name.c_str(),
- 0, NULL, 0) != 0))
+ if (!regex::match(parm_type_name_regex,
+ fn_parm_type_qualified_name))
return false;
}
}
@@ -2798,10 +2772,7 @@ function_suppression::suppresses_function_symbol(const elf_symbol* sym,
else if (!get_symbol_name_regex_str().empty())
{
const regex_t_sptr symbol_name_regex = priv_->get_symbol_name_regex();
- if (symbol_name_regex
- && (regexec(symbol_name_regex.get(),
- sym_name.c_str(),
- 0, NULL, 0) != 0))
+ if (symbol_name_regex && !regex::match(symbol_name_regex, sym_name))
return false;
}
else
@@ -2818,9 +2789,7 @@ function_suppression::suppresses_function_symbol(const elf_symbol* sym,
const regex_t_sptr symbol_version_regex =
priv_->get_symbol_version_regex();
if (symbol_version_regex
- && (regexec(symbol_version_regex.get(),
- sym_version.c_str(),
- 0, NULL, 0) != 0))
+ && !regex::match(symbol_version_regex, sym_version))
return false;
}
else
@@ -2912,12 +2881,12 @@ suppression_matches_function_name(const suppr::function_suppression& s,
{
if (regex_t_sptr regexp = s.priv_->get_name_regex())
{
- if (regexec(regexp.get(), fn_name.c_str(), 0, NULL, 0) != 0)
+ if (!regex::match(regexp, fn_name))
return false;
}
else if (regex_t_sptr regexp = s.priv_->get_name_not_regex())
{
- if (regexec(regexp.get(), fn_name.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(regexp, fn_name))
return false;
}
else if (s.priv_->name_.empty())
@@ -2948,12 +2917,12 @@ suppression_matches_function_sym_name(const suppr::function_suppression& s,
{
if (regex_t_sptr regexp = s.priv_->get_symbol_name_regex())
{
- if (regexec(regexp.get(), fn_linkage_name.c_str(), 0, NULL, 0) != 0)
+ if (!regex::match(regexp, fn_linkage_name))
return false;
}
else if (regex_t_sptr regexp = s.priv_->get_symbol_name_not_regex())
{
- if (regexec(regexp.get(), fn_linkage_name.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(regexp, fn_linkage_name))
return false;
}
else if (s.priv_->symbol_name_.empty())
@@ -2981,12 +2950,12 @@ suppression_matches_variable_name(const suppr::variable_suppression& s,
{
if (regex_t_sptr regexp = s.priv_->get_name_regex())
{
- if (regexec(regexp.get(), var_name.c_str(), 0, NULL, 0) != 0)
+ if (!regex::match(regexp, var_name))
return false;
}
else if (regex_t_sptr regexp = s.priv_->get_name_not_regex())
{
- if (regexec(regexp.get(), var_name.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(regexp, var_name))
return false;
}
else if (s.priv_->name_.empty())
@@ -3015,13 +2984,13 @@ suppression_matches_variable_sym_name(const suppr::variable_suppression& s,
{
if (regex_t_sptr regexp = s.priv_->get_symbol_name_regex())
{
- if (regexec(regexp.get(), var_linkage_name.c_str(), 0, NULL, 0) != 0)
+ if (!regex::match(regexp, var_linkage_name))
return false;
}
else if (regex_t_sptr regexp =
s.priv_->get_symbol_name_not_regex())
{
- if (regexec(regexp.get(), var_linkage_name.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(regexp, var_linkage_name))
return false;
}
else if (s.priv_->symbol_name_.empty())
@@ -3050,7 +3019,7 @@ suppression_matches_type(const suppr::type_suppression& s,
{
if (regex_t_sptr regexp = s.priv_->get_type_name_regex())
{
- if (regexec(regexp.get(), type_name.c_str(), 0, NULL, 0) != 0)
+ if (!regex::match(regexp, type_name))
return false;
}
else if (!s.get_type_name().empty())
@@ -3748,15 +3717,11 @@ variable_suppression::suppresses_variable(const var_decl* var,
if (get_name().empty())
{
const regex_t_sptr name_regex = priv_->get_name_regex();
- if (name_regex
- && (regexec(name_regex.get(), var_name.c_str(),
- 0, NULL, 0) != 0))
+ if (name_regex && !regex::match(name_regex, var_name))
return false;
const regex_t_sptr name_not_regex = priv_->get_name_not_regex();
- if (name_not_regex
- && (regexec(name_not_regex.get(), var_name.c_str(),
- 0, NULL, 0) == 0))
+ if (name_not_regex && regex::match(name_not_regex, var_name))
return false;
}
}
@@ -3772,16 +3737,12 @@ variable_suppression::suppresses_variable(const var_decl* var,
else
{
const regex_t_sptr sym_name_regex = priv_->get_symbol_name_regex();
- if (sym_name_regex
- && (regexec(sym_name_regex.get(), var_sym_name.c_str(),
- 0, NULL, 0) != 0))
+ if (sym_name_regex && !regex::match(sym_name_regex, var_sym_name))
return false;
const regex_t_sptr sym_name_not_regex =
priv_->get_symbol_name_not_regex();
- if (sym_name_not_regex
- && (regexec(sym_name_not_regex.get(), var_sym_name.c_str(),
- 0, NULL, 0) == 0))
+ if (sym_name_not_regex && regex::match(sym_name_not_regex, var_sym_name))
return false;
}
@@ -3798,9 +3759,7 @@ variable_suppression::suppresses_variable(const var_decl* var,
const regex_t_sptr symbol_version_regex =
priv_->get_symbol_version_regex();
if (symbol_version_regex
- && (regexec(symbol_version_regex.get(),
- var_sym_version.c_str(),
- 0, NULL, 0) != 0))
+ && !regex::match(symbol_version_regex, var_sym_version))
return false;
}
@@ -3818,9 +3777,7 @@ variable_suppression::suppresses_variable(const var_decl* var,
if (get_type_name().empty())
{
const regex_t_sptr type_name_regex = priv_->get_type_name_regex();
- if (type_name_regex
- && (regexec(type_name_regex.get(), var_type_name.c_str(),
- 0, NULL, 0) != 0))
+ if (type_name_regex && !regex::match(type_name_regex, var_type_name))
return false;
}
}
@@ -3911,9 +3868,7 @@ variable_suppression::suppresses_variable_symbol(const elf_symbol* sym,
else if (!get_symbol_name_regex_str().empty())
{
const regex_t_sptr sym_name_regex = priv_->get_symbol_name_regex();
- if (sym_name_regex
- && (regexec(sym_name_regex.get(), sym_name.c_str(),
- 0, NULL, 0) != 0))
+ if (sym_name_regex && !regex::match(sym_name_regex, sym_name))
return false;
}
else
@@ -3931,9 +3886,7 @@ variable_suppression::suppresses_variable_symbol(const elf_symbol* sym,
const regex_t_sptr symbol_version_regex =
priv_->get_symbol_version_regex();
if (symbol_version_regex
- && (regexec(symbol_version_regex.get(),
- sym_version.c_str(),
- 0, NULL, 0) != 0))
+ && !regex::match(symbol_version_regex, sym_version))
return false;
}
else
@@ -4229,14 +4182,14 @@ file_suppression::suppresses_file(const string& file_path)
if (regex_t_sptr regexp = suppression_base::priv_->get_file_name_regex())
{
has_regexp = true;
- if (regexec(regexp.get(), fname.c_str(), 0, NULL, 0) != 0)
+ if (!regex::match(regexp, fname))
return false;
}
if (regex_t_sptr regexp = suppression_base::priv_->get_file_name_not_regex())
{
has_regexp = true;
- if (regexec(regexp.get(), fname.c_str(), 0, NULL, 0) == 0)
+ if (regex::match(regexp, fname))
return false;
}