ext/gnomevfs/: Get the list of supported URI schemes in a threadsafe way and use...
authorSebastian Dröge <slomo@circular-chaos.org>
Sun, 20 Apr 2008 10:17:23 +0000 (10:17 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Sun, 20 Apr 2008 10:17:23 +0000 (10:17 +0000)
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
ext/gnomevfs/gstgnomevfssink.c
ext/gnomevfs/gstgnomevfssrc.c
ext/gnomevfs/gstgnomevfsuri.c

index 830d129..a81f799 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2008-04-20  Sebastian Dröge  <slomo@circular-chaos.org>
 
+       * 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  <slomo@circular-chaos.org>
+
        * ext/gio/gstgio.c: (_internal_get_supported_protocols),
        (gst_gio_get_supported_protocols):
        Don't generate a new supported protocols list on each call but cache
index 97d30ef..c7cacd8 100644 (file)
@@ -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 *
index cbe2dc8..fb60c37 100644 (file)
@@ -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 *
index 91f268f..419fb70 100644 (file)
@@ -32,8 +32,8 @@
 
 #include <gst/gst.h>
 
-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;
+}