GNOME Bugzilla – Bug 339744
[API 0.11] use the const keyword more often
Last modified: 2012-04-09 11:24:54 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)
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 ;)).
in gstquery.h struct _GstQueryTypeDefinition and in gstformat.h struct _GstFormatDefinition make fields except the GQuark const
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)
> 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.