Re: [RFC] perf/jevents: Add new structure to pass json fields.
From: Jiri Olsa
Date: Wed Aug 26 2020 - 07:01:51 EST
On Tue, Aug 25, 2020 at 01:10:41PM +0530, Kajol Jain wrote:
SNIP
> }
> }
>
> -static int save_arch_std_events(void *data, char *name, char *event,
> - char *desc, char *long_desc, char *pmu,
> - char *unit, char *perpkg, char *metric_expr,
> - char *metric_name, char *metric_group,
> - char *deprecated, char *metric_constraint)
> +static int save_arch_std_events(void *data, struct json_event *je)
> {
> struct event_struct *es;
>
> @@ -485,11 +476,8 @@ static char *real_event(const char *name, char *event)
> }
>
> static int
> -try_fixup(const char *fn, char *arch_std, char **event, char **desc,
> - char **name, char **long_desc, char **pmu, char **filter,
> - char **perpkg, char **unit, char **metric_expr, char **metric_name,
> - char **metric_group, unsigned long long eventcode,
> - char **deprecated, char **metric_constraint)
> +try_fixup(const char *fn, char *arch_std, unsigned long long eventcode,
> + struct json_event *je)
> {
> /* try to find matching event from arch standard values */
> struct event_struct *es;
> @@ -498,8 +486,7 @@ try_fixup(const char *fn, char *arch_std, char **event, char **desc,
> if (!strcmp(arch_std, es->name)) {
> if (!eventcode && es->event) {
> /* allow EventCode to be overridden */
> - free(*event);
> - *event = NULL;
> + je->event = NULL;
should you free je->event in here?
jirka