[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150120130609.GC15315@krava.brq.redhat.com>
Date: Tue, 20 Jan 2015 14:06:09 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Wang Nan <wangnan0@...wei.com>
Cc: jeremie.galarneau@...icios.com, bigeasy@...utronix.de,
lizefan@...wei.com, linux-kernel@...r.kernel.org
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists