lkml.org 
[lkml]   [2015]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] perf: convert: fix duplicate field names.
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


\
 
 \ /
  Last update: 2015-01-20 14:21    [W:0.174 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site