Re: [PATCH 1/2] perf: convert: fix duplicate field names.
From: Jiri Olsa
Date: Tue Jan 20 2015 - 08:06:38 EST
On Tue, Jan 20, 2015 at 07:07:08PM +0800, Wang Nan wrote:
SNIP
> + *
> + * So instead of checking duplication, simply tries 10 times.
> + */
> + for (dup = 0; dup < 10; dup ++) {
> + struct bt_ctf_field_type *f;
> + char *dupl_name = get_dupl_name(field->name, dup);
> +
> + if (!dupl_name) {
> + pr_err("Failed to alloc memory for dup '%s'\n",
> + field->name);
> + return -1;
> + }
> +
> + ret = bt_ctf_event_class_add_field(event_class, type,
> + dupl_name);
> + free(dupl_name);
> + if (ret)
> + continue;
hum.. so we dont know if we failed because of the name, but we keep
trying 10 times anyway.. does not seem nice to me
how about using that function you mentioned in the above comment
to get the proper name first, like:
while(bt_ctf_event_class_get_field_by_name(name))
change_name(name)
and then add use it for bt_ctf_event_class_add_field
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/