gst/: Use already-interned string for the private GstPluginFeature plugin_name field.

Original commit message from CVS:
* gst/gstelementfactory.c:
* gst/gstpluginfeature.c:
* gst/gstpluginfeature.h:
* gst/gstregistrybinary.c:
* gst/gstregistryxml.c:
* gst/gsttypefind.c:
Use already-interned string for the private GstPluginFeature
plugin_name field.
This commit is contained in:
Tim-Philipp Müller 2007-10-13 17:20:09 +00:00
parent 784cb99d99
commit f134968058
7 changed files with 25 additions and 14 deletions

View file

@ -1,3 +1,14 @@
2007-10-13 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstelementfactory.c:
* gst/gstpluginfeature.c:
* gst/gstpluginfeature.h:
* gst/gstregistrybinary.c:
* gst/gstregistryxml.c:
* gst/gsttypefind.c:
Use already-interned string for the private GstPluginFeature
plugin_name field.
2007-10-10 Tim-Philipp Müller <tim at centricular dot net>
* docs/libs/gstreamer-libs-sections.txt:

View file

@ -326,9 +326,9 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
g_free (interfaces);
if (plugin && plugin->desc.name) {
GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name);
GST_PLUGIN_FEATURE (factory)->plugin_name = plugin->desc.name;
} else {
GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup ("NULL");
GST_PLUGIN_FEATURE (factory)->plugin_name = "NULL";
}
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
GST_PLUGIN_FEATURE (factory)->loaded = TRUE;

View file

@ -69,7 +69,6 @@ gst_plugin_feature_finalize (GObject * object)
GST_DEBUG ("finalizing feature %p: '%s'", feature,
GST_PLUGIN_FEATURE_NAME (feature));
g_free (feature->name);
g_free (feature->plugin_name);
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View file

@ -76,14 +76,14 @@ typedef enum {
* Opaque #GstPluginFeature structure.
*/
struct _GstPluginFeature {
GstObject object;
GstObject object;
/*< private >*/
gboolean loaded;
gchar *name;
guint rank;
gchar *name;
guint rank;
gchar *plugin_name;
const gchar *plugin_name;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2006 Josep Torra <josep@fluendo.com>
* 2006 Mathieu Garcia <matthieu@fluendo.com>
* 2006,2007 Stefan Kost <ensonic@users.sf.net>
* 2006,2007 Stefan Kost <ensonic@users.sf.net>
*
* gstregistrybinary.c: GstRegistryBinary object, support routines
*
@ -649,7 +649,7 @@ gst_registry_binary_load_pad_template (GstElementFactory * factory, gchar ** in)
*/
static gboolean
gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
gchar * plugin_name)
const gchar * plugin_name)
{
GstBinaryPluginFeature *pf = NULL;
GstPluginFeature *feature;
@ -768,7 +768,9 @@ gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
#endif
feature->rank = pf->rank;
feature->plugin_name = plugin_name;
/* should already be the interned string, but better make sure */
feature->plugin_name = g_intern_string (plugin_name);
gst_registry_add_feature (registry, feature);
GST_DEBUG ("Added feature %s", feature->name);
@ -838,8 +840,7 @@ gst_registry_binary_load_plugin (GstRegistry * registry, gchar ** in)
GST_INFO ("Added plugin '%s' plugin with %d features from binary registry",
plugin->desc.name, pe->nfeatures);
for (i = 0; i < pe->nfeatures; i++) {
if (!gst_registry_binary_load_feature (registry, in,
g_strdup (plugin->desc.name))) {
if (!gst_registry_binary_load_feature (registry, in, plugin->desc.name)) {
GST_ERROR ("Error while loading binary feature");
goto fail;
}

View file

@ -473,7 +473,7 @@ load_plugin (xmlTextReaderPtr reader, GList ** feature_list)
GstPluginFeature *feature = load_feature (reader);
if (feature) {
feature->plugin_name = g_strdup (plugin->desc.name);
feature->plugin_name = plugin->desc.name; /* interned string */
*feature_list = g_list_prepend (*feature_list, feature);
}
} else {

View file

@ -96,7 +96,7 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
factory->function = func;
factory->user_data = data;
factory->user_data_notify = data_notify;
GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name);
GST_PLUGIN_FEATURE (factory)->plugin_name = plugin->desc.name; /* interned string */
GST_PLUGIN_FEATURE (factory)->loaded = TRUE;
gst_registry_add_feature (gst_registry_get_default (),