After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763213 - Add documentation about _NAME macros vs. _get_name functions
Add documentation about _NAME macros vs. _get_name functions
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 1.7.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-07 10:17 UTC by Carlos Rafael Giani
Modified: 2016-03-11 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
extra documentation for GstObject & GstElement name macros & functions (2.26 KB, patch)
2016-03-07 10:17 UTC, Carlos Rafael Giani
none Details | Review
element: flesh out macro accessor docs a bit (2.16 KB, patch)
2016-03-07 10:31 UTC, Tim-Philipp Müller
none Details | Review
extra docs for element and object accessors (3.10 KB, patch)
2016-03-10 09:34 UTC, Carlos Rafael Giani
none Details | Review
v2, small cleanup in the commit (3.09 KB, patch)
2016-03-10 09:38 UTC, Carlos Rafael Giani
committed Details | Review

Description Carlos Rafael Giani 2016-03-07 10:17:24 UTC
Created attachment 323243 [details] [review]
extra documentation for GstObject & GstElement name macros & functions

There are GST_OBJECT_NAME(), GST_ELEMENT_NAME(), gst_object_get_name(), gst_element_get_name() macros and functions. It can be confusing to distinguish these. This small commit adds notes to the documentation to clarify the differences.
Comment 1 Tim-Philipp Müller 2016-03-07 10:31:46 UTC
Created attachment 323245 [details] [review]
element: flesh out macro accessor docs a bit

Just added some docs as well :)
Comment 2 Tim-Philipp Müller 2016-03-08 09:00:29 UTC
Comment on attachment 323243 [details] [review]
extra documentation for GstObject & GstElement name macros & functions

As discussed on IRC..
>+ * It is recommended to use this instead of the GST_ELEMENT_NAME() macro,
>+ * which is mostly useful for internal use in the core only.

I don't know if GST_ELEMENT_NAME is really mostly only for internal use. It has its uses, it's just not thread-safe.

>+ * This call is essentially the same as gst_object_get_name(), except that
>+ * it can be directly used with GstElement pointers.

Both the macro and _get_name() function calls are "used directly" with GstElement pointers?


>+ * <warning><para>
>+ * This returns the pointer to the internal name, which can be subject to
>+ * external changes. It is not MT safe. In most cases, using the
>+ * using gst_object_get_name() instead is the better choice. This macro
>+ * is only really useful for internal use in the case and for cases when
>+ * the implicit string copy this function performs must be avoided.
>+ * </para></warning>

This should not be a warning. And I'm not sure why the string copying of _get_name() is 'implicit' here.
Comment 3 Carlos Rafael Giani 2016-03-10 09:34:07 UTC
Created attachment 323596 [details] [review]
extra docs for element and object accessors

Here's an updated version. It extends Tim's patch to GST_OBJECT_NAME and GST_OBJECT_PARENT , so both my and his patch are replaced by this. (For some reason, I can't mark both patches obsolete.)
Comment 4 Carlos Rafael Giani 2016-03-10 09:38:14 UTC
Created attachment 323598 [details] [review]
v2, small cleanup in the commit
Comment 5 Tim-Philipp Müller 2016-03-10 10:13:13 UTC
Thanks

commit f70dc95c35684ad12e7ad7a77c62bf0bcdab9972
Author: Carlos Rafael Giani <dv@pseudoterminal.org>
Date:   Thu Mar 10 10:35:40 2016 +0100

    docs: Flesh out element and object macro accessor docs a bit
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763213