Re: [PATCH 5/9] perf utils: add support for arch standard events

From: Jiri Olsa
Date: Thu Feb 08 2018 - 08:54:34 EST


On Wed, Feb 07, 2018 at 01:45:00AM +0800, John Garry wrote:

SNIP

> static void print_events_table_suffix(FILE *outfp)
> {
> fprintf(outfp, "{\n");
> @@ -407,6 +469,52 @@ static char *real_event(const char *name, char *event)
> return event;
> }
>
> +static void fixup_field(char *from, char **to)
> +{
> + *to = malloc(strlen(from));
> +
> + strcpy(*to, from);
> +}

could you just call '*to = strdup(from)' in here?

jirka