registry: avoid calling _get_name() too much

Avoid calling gst_plugin_get_name() too many times but instead cache
the value.
This commit is contained in:
Wim Taymans 2009-05-02 14:39:48 +02:00 committed by Wim Taymans
parent 84c5db2635
commit ceb74fe2cf

View file

@ -368,20 +368,22 @@ gst_registry_remove_features_for_plugin_unlocked (GstRegistry * registry,
GstPlugin * plugin) GstPlugin * plugin)
{ {
GList *f; GList *f;
const gchar *name;
g_return_if_fail (GST_IS_REGISTRY (registry)); g_return_if_fail (GST_IS_REGISTRY (registry));
g_return_if_fail (GST_IS_PLUGIN (plugin)); g_return_if_fail (GST_IS_PLUGIN (plugin));
name = gst_plugin_get_name (plugin);
/* Remove all features for this plugin */ /* Remove all features for this plugin */
f = registry->features; f = registry->features;
while (f != NULL) { while (f != NULL) {
GList *next = g_list_next (f); GList *next = g_list_next (f);
GstPluginFeature *feature = f->data; GstPluginFeature *feature = f->data;
if (feature && !strcmp (feature->plugin_name, gst_plugin_get_name (plugin))) { if (feature && !strcmp (feature->plugin_name, name)) {
GST_DEBUG_OBJECT (registry, "removing feature %p (%s) for plugin %s", GST_DEBUG_OBJECT (registry, "removing feature %p (%s) for plugin %s",
feature, gst_plugin_feature_get_name (feature), feature, gst_plugin_feature_get_name (feature), name);
gst_plugin_get_name (plugin));
registry->features = g_list_delete_link (registry->features, f); registry->features = g_list_delete_link (registry->features, f);
g_hash_table_remove (registry->feature_hash, feature->name); g_hash_table_remove (registry->feature_hash, feature->name);