The 2 non-test uses of perf_cpu_map__merge both do:
a = perf_cpu_map__merge(a, b);
so another way to make the API less misleading would be
to introduce:
err = perf_cpu_map__merge_in(&a, b);
where:
int perf_cpu_map__merge_in(struct perf_cpu_map **orig, struct perf_cpu_map *other)
{
struct perf_cpu_map *result = perf_cpu_map__merge(*orig, other);
if (!result)
return -ENOMEM;
*orig = result;
return 0;
}
without any changes to perf_cpu_map__merge().
Just wandering why we cannot do the same thing for the perf_cpu_map__merge()
function?
int perf_cpu_map__merge_in(struct perf_cpu_map **orig,
struct perf_cpu_map *other)
This can allow us to avoid any confusion in the first place. And we don't need
to maintain two functions for the same thing.
Thanks,
Leo