Re: [PATCH v5 1/2] perf parse: Refactor struct perf_evsel_config_term
From: Andi Kleen
Date: Mon Jan 13 2020 - 13:43:46 EST
On Mon, Jan 13, 2020 at 11:18:05PM +0800, Leo Yan wrote:
> The struct perf_evsel_config_term::val is a union which contains
> fields 'callgraph', 'drv_cfg' and 'branch' as string pointers. This
> leads to the complex code logic for handling every type's string
> separately, and it's hard to release string as a general way.
>
> This patch refactors the structure to add a common field 'str' in the
> 'val' union as string pointer and remove the other three fields
> 'callgraph', 'drv_cfg' and 'branch'. Without passing field name, the
> patch simplifies the string handling with macro ADD_CONFIG_TERM_STR()
> for string pointer assignment.
Looks like a good cleanup.
Reviewed-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
-Andi