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 339744 - [API 0.11] use the const keyword more often
[API 0.11] use the const keyword more often
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-04-25 19:14 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2012-04-09 11:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stefan Sauer (gstreamer, gtkdoc dev) 2006-04-25 19:14:05 UTC
GstPadTemplate *
gst_static_pad_template_get (GstStaticPadTemplate * pad_template)

should be 

GstPadTemplate *
gst_static_pad_template_get (const GstStaticPadTemplate * pad_template)

---

gboolean
gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
    GstTypeFindFunction func, gchar ** extensions,
    const GstCaps * possible_caps, gpointer data, GDestroyNotify data_notify)

should be

gboolean
gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
    GstTypeFindFunction func, const gchar ** extensions,
    const GstCaps * possible_caps, gpointer data, GDestroyNotify data_notify)
Comment 1 Tim-Philipp Müller 2006-04-25 19:35:00 UTC
while we're at it, we could save quite a bit of memory if we didn't g_strdup() all those element detail strings in

void
gst_element_class_set_details (GstElementClass * klass,
    const GstElementDetails * details);

which are almost always const strings anyway (the few cases where that isn't the case we can just alloc + leak IMHO, or convert to a GQuark and get the string and then blame GLib ;)).
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2006-06-08 13:18:59 UTC
in gstquery.h
struct _GstQueryTypeDefinition
and in gstformat.h
struct _GstFormatDefinition

make fields except the GQuark const
Comment 3 Tim-Philipp Müller 2006-06-13 09:04:29 UTC
Just came across this, might be useful to keep in mind when going over this stuff for 0.11:

  http://udrepper.livejournal.com/10946.html  (last few paragraphs)

Comment 4 Tim-Philipp Müller 2012-04-09 11:24:54 UTC
 > gst_static_pad_template_get (GstStaticPadTemplate * pad_template)
> should be 
> gst_static_pad_template_get (const GstStaticPadTemplate * pad_template)

That's a bit tricky, because the static caps which are part of the static pad template structure are ref'ed here, so the structure is actually changed (also, the static caps may be created/inited on demand).

> gst_type_find_register (..., gchar ** extensions, ...)
> should be
> gst_type_find_register (..., const gchar ** extensions, ...)

This is a simple const gchar * extensions now.


> in gstquery.h
> struct _GstQueryTypeDefinition

This is gone now afaict.

> and in gstformat.h
> struct _GstFormatDefinition
> make fields except the GQuark const

Done, I think.

> we could save quite a bit of memory if we didn't g_strdup()
> all those element detail strings in
>   gst_element_class_set_details (GstElementClass * klass,
>       const GstElementDetails * details);
> which are almost always const strings anyway

We can add _{set,add}_static_metadata() functions later for this.