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 343346 - [0.11] add G_GNUC_NULL_TERMINATED to gst_structure_empty_new()
[0.11] add G_GNUC_NULL_TERMINATED to gst_structure_empty_new()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal enhancement
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-05-30 00:19 UTC by Johan Boulé
Modified: 2011-10-27 13:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for G_GNUC_NULL_TERMINATED (2.75 KB, patch)
2006-05-30 00:20 UTC, Johan Boulé
none Details | Review
patch which uses gst_structure_empty_new instead of passing NULL, NULL (3.64 KB, patch)
2006-05-30 12:12 UTC, Jan Schmidt
none Details | Review

Description Johan Boulé 2006-05-30 00:19:13 UTC
this patch adds G_GNUC_NULL_TERMINATED in the few places were it was missing.
were needed, NULL is passed two times to avoid the warning "not enough variable arguments to fit a sentinel"
Comment 1 Johan Boulé 2006-05-30 00:20:39 UTC
Created attachment 66450 [details] [review]
patch for G_GNUC_NULL_TERMINATED
Comment 2 Jan Schmidt 2006-05-30 12:09:40 UTC
I'm not sure we can actually do this, although it would be nice.

In existing apps, it is valid to do gst_structure_new ("Name", NULL), because
it internally checks for the first fieldname being NULL, even though it's separate from the varargs. Of course, such code is better off using gst_structure_empty_new for a little more efficiency.

However, adding the argument means that existing code using this idiom will fail to compile, even though it's valid. Ditto for the gst_caps_new methods.

I think we have to punt this to 0.11.


Comment 3 Jan Schmidt 2006-05-30 12:12:15 UTC
Created attachment 66467 [details] [review]
patch which uses gst_structure_empty_new instead of passing NULL, NULL
Comment 4 Wim Taymans 2006-06-12 09:59:54 UTC
can you commit this _empty_new fixes without the G_GNUC_NULL_TERMINATED, for now?
Comment 5 Tim-Philipp Müller 2006-06-12 10:37:24 UTC
> However, adding the argument means that existing code using this idiom will
> fail to compile, even though it's valid. Ditto for the gst_caps_new methods.
> 
> I think we have to punt this to 0.11.

Really? I thought all that adding G_GNUC_NULL_TERMINATED did was make the compiler spew a warning if the argument list doesn't end as expected, so compilation should only fail if -Werror is being used, no?




Comment 6 Jan Schmidt 2006-06-12 11:22:13 UTC
Yes, I think you're right - but gst_structure_new (name, NULL) is legitimate and correctly behaving code, and we'd be breaking their compilation with a bogus and misleading warning.
Comment 7 Tim-Philipp Müller 2011-10-27 12:26:05 UTC
commit c00c8903caf981651b7db0d876ad40e96b98df9e
Author: Tim-Philipp Müller <tim.muller@collabora.co.uk>
Date:   Thu Oct 27 13:25:08 2011 +0100

    structure: use G_GNUC_NULL_TERMINATED for gst_structure_new()
    
    If you get a warning, use gst_structure_empty_new().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=343346
Comment 8 Tim-Philipp Müller 2011-10-27 13:59:05 UTC
commit 3406549cf66a8b8ea9a9500e8cf5132a6bd806e2
Author: Johan Boulé <bohan.gnome@retropaganda.info>
Date:   Thu Oct 27 14:56:24 2011 +0100

    caps: use G_GNUC_NULL_TERMINATED for gst_caps_new_simple() and gst_caps_new_full()
    
    If you get warnings, use gst_caps_new_empty().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=343346