[Bug 748233] Add support for a format-specifier to GstObject names for uniqueness
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Tue Apr 21 07:23:03 PDT 2015
https://bugzilla.gnome.org/show_bug.cgi?id=748233
--- Comment #2 from Nirbheek Chauhan <nirbheek.chauhan at gmail.com> ---
(In reply to Tim-Philipp Müller from comment #1)
> Comment on attachment 302051 [details] [review]
> gstobject: Add support for a format-specifier suffix
>
> I think this is a nice idea and would be useful to have.
>
> Two comments:
>
> - gst_object_set_name_numbered() and _set_name_default()
> share 90% of the code. Perhaps that datalist thing
> could be refactored into a shared internal utility
> function (pass quark + ..) ?
>
Yep, my first attempt was by adding branches in _set_name_default(), and it was
quite ugly. I'll refactor out the datalist stuff so it can be reused. Didn't
think of that. :)
> - is there a reason to mandate the hyphen in the suffix
> rather than just check for %u ?
So, in _set_name_default(), there's this code:
/* give the 20th "queue" element and the first "queue2" different names */
l = strlen (type_name);
if (l > 0 && g_ascii_isdigit (type_name[l - 1])) {
name = g_strdup_printf ("%s-%d", type_name, count);
} else {
name = g_strdup_printf ("%s%d", type_name, count);
}
I wanted to avoid the same problem here, so it made sense to mandate the suffix
to be "-%u" rather than duplicate that hack here. In my opinion, for
consistency, even that code should always just do "-%d" instead of checking the
last character in the type_name.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list