Re: [PATCH 14/54] perf tools: Support setting different slots in a BPF map separately
From: Jiri Olsa
Date: Fri Feb 12 2016 - 09:23:56 EST
On Fri, Feb 05, 2016 at 02:01:39PM +0000, Wang Nan wrote:
SNIP
>
> +int parse_events__merge_arrays(struct parse_events_array *dest,
> + struct parse_events_array *another)
> +{
> + struct parse_events_array new;
> +
> + if (!dest || !another)
> + return -EINVAL;
> +
> + new.nr_ranges = dest->nr_ranges + another->nr_ranges;
> + new.ranges = malloc(sizeof(new.ranges[0]) * new.nr_ranges);
> + if (!new.ranges)
> + return -ENOMEM;
> +
> + memcpy(&new.ranges[0], dest->ranges,
> + sizeof(new.ranges[0]) * dest->nr_ranges);
> + memcpy(&new.ranges[dest->nr_ranges], another->ranges,
> + sizeof(new.ranges[0]) * another->nr_ranges);
> + free(dest->ranges);
> + free(another->ranges);
> + *dest = new;
> + return 0;
> +}
is there a user for this function in this patchset? can't find it..
I recall I've already seen it in earlier versions, but can't find it now ;-)
jirka