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> 2007-10-10 Tim-Philipp Müller <tim at centricular dot net>
* docs/libs/gstreamer-libs-sections.txt: * 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); g_free (interfaces);
if (plugin && plugin->desc.name) { 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 { } 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_set_rank (GST_PLUGIN_FEATURE (factory), rank);
GST_PLUGIN_FEATURE (factory)->loaded = TRUE; 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_DEBUG ("finalizing feature %p: '%s'", feature,
GST_PLUGIN_FEATURE_NAME (feature)); GST_PLUGIN_FEATURE_NAME (feature));
g_free (feature->name); g_free (feature->name);
g_free (feature->plugin_name);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }

View file

@ -83,7 +83,7 @@ struct _GstPluginFeature {
gchar *name; gchar *name;
guint rank; guint rank;
gchar *plugin_name; const gchar *plugin_name;
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];

View file

@ -649,7 +649,7 @@ gst_registry_binary_load_pad_template (GstElementFactory * factory, gchar ** in)
*/ */
static gboolean static gboolean
gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in, gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
gchar * plugin_name) const gchar * plugin_name)
{ {
GstBinaryPluginFeature *pf = NULL; GstBinaryPluginFeature *pf = NULL;
GstPluginFeature *feature; GstPluginFeature *feature;
@ -768,7 +768,9 @@ gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
#endif #endif
feature->rank = pf->rank; 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_registry_add_feature (registry, feature);
GST_DEBUG ("Added feature %s", feature->name); 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", GST_INFO ("Added plugin '%s' plugin with %d features from binary registry",
plugin->desc.name, pe->nfeatures); plugin->desc.name, pe->nfeatures);
for (i = 0; i < pe->nfeatures; i++) { for (i = 0; i < pe->nfeatures; i++) {
if (!gst_registry_binary_load_feature (registry, in, if (!gst_registry_binary_load_feature (registry, in, plugin->desc.name)) {
g_strdup (plugin->desc.name))) {
GST_ERROR ("Error while loading binary feature"); GST_ERROR ("Error while loading binary feature");
goto fail; goto fail;
} }

View file

@ -473,7 +473,7 @@ load_plugin (xmlTextReaderPtr reader, GList ** feature_list)
GstPluginFeature *feature = load_feature (reader); GstPluginFeature *feature = load_feature (reader);
if (feature) { 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); *feature_list = g_list_prepend (*feature_list, feature);
} }
} else { } else {

View file

@ -96,7 +96,7 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
factory->function = func; factory->function = func;
factory->user_data = data; factory->user_data = data;
factory->user_data_notify = data_notify; 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_PLUGIN_FEATURE (factory)->loaded = TRUE;
gst_registry_add_feature (gst_registry_get_default (), gst_registry_add_feature (gst_registry_get_default (),