diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2007-10-13 17:20:09 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2007-10-13 17:20:09 +0000 |
commit | f1349680589d22b165d796bf52b1f24ee9e6171d (patch) | |
tree | ba3de5029d21de4dd5109be6de1105ca7b36047d /gst | |
parent | 784cb99d99cd8dd62b3ca6588e1dc52535e90e3d (diff) |
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.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstelementfactory.c | 4 | ||||
-rw-r--r-- | gst/gstpluginfeature.c | 1 | ||||
-rw-r--r-- | gst/gstpluginfeature.h | 8 | ||||
-rw-r--r-- | gst/gstregistrybinary.c | 11 | ||||
-rw-r--r-- | gst/gstregistryxml.c | 2 | ||||
-rw-r--r-- | gst/gsttypefind.c | 2 |
6 files changed, 14 insertions, 14 deletions
diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 4492cfb62d..cc6367ef30 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -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; diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c index 4430874936..1aae359afb 100644 --- a/gst/gstpluginfeature.c +++ b/gst/gstpluginfeature.c @@ -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); } diff --git a/gst/gstpluginfeature.h b/gst/gstpluginfeature.h index 3319947882..323cbb576c 100644 --- a/gst/gstpluginfeature.h +++ b/gst/gstpluginfeature.h @@ -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]; diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c index ad59971738..76396a7b79 100644 --- a/gst/gstregistrybinary.c +++ b/gst/gstregistrybinary.c @@ -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; } diff --git a/gst/gstregistryxml.c b/gst/gstregistryxml.c index 75a1e6e1c7..1c0f5924ae 100644 --- a/gst/gstregistryxml.c +++ b/gst/gstregistryxml.c @@ -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 { diff --git a/gst/gsttypefind.c b/gst/gsttypefind.c index eb3df534e5..b268365d0d 100644 --- a/gst/gsttypefind.c +++ b/gst/gsttypefind.c @@ -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 (), |