From fb2dc81a97fc81613e676f69915f59fb6e7661f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 20 Apr 2008 10:17:23 +0000 Subject: [PATCH] ext/gnomevfs/: Get the list of supported URI schemes in a threadsafe way and use the same list for the source and sink. Original commit message from CVS: * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_uri_get_protocols): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_uri_get_protocols): * ext/gnomevfs/gstgnomevfsuri.c: (_internal_get_supported_uris), (gst_gnomevfs_get_supported_uris): Get the list of supported URI schemes in a threadsafe way and use the same list for the source and sink. --- ChangeLog | 11 +++++++++++ ext/gnomevfs/gstgnomevfssink.c | 7 +------ ext/gnomevfs/gstgnomevfssrc.c | 7 +------ ext/gnomevfs/gstgnomevfsuri.c | 13 +++++++++++-- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 830d129346..a81f799dd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-04-20 Sebastian Dröge + + * ext/gnomevfs/gstgnomevfssink.c: + (gst_gnome_vfs_sink_uri_get_protocols): + * ext/gnomevfs/gstgnomevfssrc.c: + (gst_gnome_vfs_src_uri_get_protocols): + * ext/gnomevfs/gstgnomevfsuri.c: (_internal_get_supported_uris), + (gst_gnomevfs_get_supported_uris): + Get the list of supported URI schemes in a threadsafe way and use the + same list for the source and sink. + 2008-04-20 Sebastian Dröge * ext/gio/gstgio.c: (_internal_get_supported_protocols), diff --git a/ext/gnomevfs/gstgnomevfssink.c b/ext/gnomevfs/gstgnomevfssink.c index 97d30ef440..c7cacd882a 100644 --- a/ext/gnomevfs/gstgnomevfssink.c +++ b/ext/gnomevfs/gstgnomevfssink.c @@ -596,12 +596,7 @@ gst_gnome_vfs_sink_uri_get_type (void) static gchar ** gst_gnome_vfs_sink_uri_get_protocols (void) { - static gchar **protocols = NULL; - - if (!protocols) - protocols = gst_gnomevfs_get_supported_uris (); - - return protocols; + return gst_gnomevfs_get_supported_uris (); } static const gchar * diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index cbe2dc85a1..fb60c37438 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -350,12 +350,7 @@ gst_gnome_vfs_src_uri_get_type (void) static gchar ** gst_gnome_vfs_src_uri_get_protocols (void) { - static gchar **protocols = NULL; - - if (!protocols) - protocols = gst_gnomevfs_get_supported_uris (); - - return protocols; + return gst_gnomevfs_get_supported_uris (); } static const gchar * diff --git a/ext/gnomevfs/gstgnomevfsuri.c b/ext/gnomevfs/gstgnomevfsuri.c index 91f268f8ba..419fb70f66 100644 --- a/ext/gnomevfs/gstgnomevfsuri.c +++ b/ext/gnomevfs/gstgnomevfsuri.c @@ -32,8 +32,8 @@ #include -gchar ** -gst_gnomevfs_get_supported_uris (void) +static gpointer +_internal_get_supported_uris (gpointer data) { /* no dav/davs in the list, because they don't appear to be reliable enough */ const gchar *uris[] = { @@ -76,3 +76,12 @@ gst_gnomevfs_get_supported_uris (void) return result; } + +gchar ** +gst_gnomevfs_get_supported_uris (void) +{ + static GOnce once = G_ONCE_INIT; + + g_once (&once, _internal_get_supported_uris, NULL); + return (gchar **) once.retval; +}