[v4,09/15] Refactor read_parameter_spec_from_string logic.
Commit Message
This function extracts either a string or a regex from the same input.
This patch simplifies the string vs regex conditional logic, in order
to make following patches simpler.
There are no behavioural changes.
* src/abg-suppression.cc (read_parameter_spec_from_string):
Use separate string and regex variables to simplify the
creation of returned parameter specification.
Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
src/abg-suppression.cc | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
Comments
Giuliano Procida <gprocida@google.com> a écrit:
> This function extracts either a string or a regex from the same input.
> This patch simplifies the string vs regex conditional logic, in order
> to make following patches simpler.
>
> There are no behavioural changes.
>
> * src/abg-suppression.cc (read_parameter_spec_from_string):
> Use separate string and regex variables to simplify the
> creation of returned parameter specification.
Acked-by: Dodji Seketeli <dodji@seketeli.org>
Applied to master, thanks.
[...]
Cheers,
@@ -3085,13 +3085,15 @@ read_parameter_spec_from_string(const string& str)
if (!index_str.empty() || !type_name.empty())
{
- function_suppression::parameter_spec* p;
+ std::string type_name_regex;
if (is_regex)
- p = new function_suppression::parameter_spec(atoi(index_str.c_str()),
- "", type_name);
- else
- p = new function_suppression::parameter_spec(atoi(index_str.c_str()),
- type_name, "");
+ {
+ type_name_regex = type_name;
+ type_name.clear();
+ }
+ function_suppression::parameter_spec* p =
+ new function_suppression::parameter_spec(atoi(index_str.c_str()),
+ type_name, type_name_regex);
result.reset(p);
}