]> git.sesse.net Git - vlc/commitdiff
Move psz_vlcpath out of p_root
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 28 Sep 2008 17:18:01 +0000 (20:18 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 28 Sep 2008 17:18:01 +0000 (20:18 +0300)
src/config/dirs.c
src/libvlc.h
src/misc/beos_specific.cpp
src/misc/darwin_specific.c
src/misc/linux_specific.c
src/misc/threads.c
src/misc/variables.c
src/misc/win32_specific.c
src/modules/modules.c

index 5877b4b2f109c9bbd948cb4e827ad91f171f12c6..16cbf8134c85f4f26b506be6a3e741ff7da7d862 100644 (file)
@@ -64,8 +64,7 @@ const char *config_GetDataDir( void )
 
     if( *path == '\0' )
     {
-        snprintf( path, sizeof( path ), "%s" DIR_SEP DIR_SHARE,
-                  vlc_global()->psz_vlcpath );
+        snprintf( path, sizeof( path ), "%s" DIR_SEP DIR_SHARE, psz_vlcpath );
         path[sizeof( path ) - 1] = '\0';
     }
     return path;
@@ -155,7 +154,7 @@ const char *config_GetConfDir( void )
     if( *path == '\0' )
     {
         snprintf( path, sizeof( path ), "%s"DIR_SEP DIR_SHARE, /* FIXME: Duh? */
-                  vlc_global()->psz_vlcpath );
+                  psz_vlcpath );
         path[sizeof( path ) - 1] = '\0';
     }
     return path;
index 8b47fd408bbba783f78329892be4dd7a396ce2e9..fbf1a02671af9fc3aed97df1b38970b5295ca5fa 100644 (file)
@@ -140,26 +140,14 @@ __vlc_custom_create (vlc_object_t *p_this, size_t i_size, int i_type,
 #define vlc_custom_create(o, s, t, n) \
         __vlc_custom_create(VLC_OBJECT(o), s, t, n)
 
-/**
- * libvlc_global_data_t (global variable)
- *
- * This structure has an unique instance, statically allocated in libvlc and
- * never accessed from the outside. It stores process-wide VLC variables,
- * mostly process-wide locks, and (currently) the module bank and objects tree.
- */
-typedef struct libvlc_global_data_t
-{
-    VLC_COMMON_MEMBERS
-
-    char *                 psz_vlcpath;
-} libvlc_global_data_t;
 
 /**
  * The module bank
  */
 extern module_bank_t *p_module_bank;
 
-libvlc_global_data_t *vlc_global (void);
+vlc_object_t *vlc_global (void);
+extern char *psz_vlcpath;
 
 /**
  * Private LibVLC data for each object.
index f1a14d08f75057600a04b9a8205771837e754609..8dbec2e1637e0322a230bd3fc2bf16022fffda4d 100644 (file)
@@ -112,7 +112,7 @@ void system_End( libvlc_int_t *p_this )
     vlc_thread_join( p_appthread );
     vlc_object_release( p_appthread );
 
-    free( vlc_global()->psz_vlcpath );
+    free( psz_vlcpath );
 }
 
 /* following functions are local */
@@ -182,7 +182,7 @@ void VlcApplication::ReadyToRun( )
     BEntry entry( &info.ref );
     entry.GetPath( &path );
     path.GetParent( &path );
-    vlc_global()->psz_vlcpath = strdup( path.Path() );
+    psz_vlcpath = strdup( path.Path() );
 
     /* Tell the main thread we are finished initializing the BApplication */
     vlc_thread_ready( p_this );
index 6e68ee1241dea61c9f0cc69414c11b3f5d89529d..f751c63c8ea939859b22b35a40ded2b91ad5f4ac 100644 (file)
@@ -123,7 +123,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
         p_char = strdup( ppsz_argv[ 0 ] );
     }
 
-    vlc_global()->psz_vlcpath = p_char;
+    psz_vlcpath = p_char;
 
     /* Remove trailing program name */
     for( ; *p_char ; )
@@ -186,6 +186,6 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv
 void system_End( libvlc_int_t *p_this )
 {
     (void)p_this;
-    free( vlc_global()->psz_vlcpath );
+    free( psz_vlcpath );
 }
 
index 0a4be0ad7988c03822b9c20d456e4df35106b0a4..6dbf25eb7b7462704967a9add9959d39d123e2b3 100644 (file)
@@ -36,7 +36,7 @@ static void set_libvlc_path (void)
 
     assert (strlen (LIBDIR) < sizeof (libvlc_path));
     strcpy (libvlc_path, LIBDIR); /* fail safe */
-    vlc_global ()->psz_vlcpath = libvlc_path;
+    psz_vlcpath = libvlc_path;
 
     /* Find the path to libvlc (i.e. ourselves) */
     FILE *maps = fopen ("/proc/self/maps", "rt");
index 32855d12c2ce3b4137164f69675b10a95373c56b..6d0865382a1b16b899cb3bfefec67384a1c960a1 100644 (file)
@@ -59,11 +59,12 @@ static vlc_threadvar_t cancel_key;
 
 /**
  * Global process-wide VLC object.
- * Contains inter-instance data, such as the module cache and global mutexes.
+ * Contains the global named mutexes.
+ * TODO: remove it.
  */
-static libvlc_global_data_t *p_root;
+static vlc_object_t *p_root;
 
-libvlc_global_data_t *vlc_global( void )
+vlc_object_t *vlc_global( void )
 {
     assert( i_initializations > 0 );
     return p_root;
index c524568ba11565881ec3abbb709bae25253ff7c2..37fcd798f95d21e609cbd110d16a18e86fca1b6f 100644 (file)
@@ -856,7 +856,7 @@ int __var_Get( vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val )
  */
 vlc_mutex_t *var_AcquireMutex( const char *name )
 {
-    libvlc_global_data_t *p_global = vlc_global();
+    vlc_object_t *p_global = vlc_global();
     vlc_value_t val;
 
     if( var_Create( p_global, name, VLC_VAR_MUTEX ) )
index 1f027cc51767bbfdd1ff71c9a71b79eed73856af..b89eabfefde02700b71548e8b0c4153a920f4518 100644 (file)
@@ -76,7 +76,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
     }
 #endif
 
-    vlc_global()->psz_vlcpath = strdup( psz_path );
+    psz_vlcpath = strdup( psz_path );
 
     /* Set the default file-translation mode */
 #if !defined( UNDER_CE )
@@ -371,8 +371,8 @@ void system_End( libvlc_int_t *p_this )
     HWND ipcwindow;
     if( p_this && vlc_global() )
     {
-        free( vlc_global()->psz_vlcpath );
-        vlc_global()->psz_vlcpath = NULL;
+        free( psz_vlcpath );
+        psz_vlcpath = NULL;
     }
 
     if( ipcwindow = FindWindow( 0, L"VLC ipc "VERSION ) )
index 85b12ae992e937aa9f1ff0e6677dfeef37448c73..ee036e31310f3a303803555188c4316d1a48c626 100644 (file)
@@ -867,13 +867,15 @@ static char * copy_next_paths_token( char * paths, char ** remaining_paths )
     return path;
 }
 
+extern char *psz_vlcpath = NULL;
+
 /*****************************************************************************
  * AllocateAllPlugins: load all plugin modules we can find.
  *****************************************************************************/
 #ifdef HAVE_DYNAMIC_PLUGINS
 static void AllocateAllPlugins( vlc_object_t *p_this )
 {
-    const char *vlcpath = vlc_global()->psz_vlcpath;
+    const char *vlcpath = psz_vlcpath;
     int count,i;
     char * path;
     vlc_array_t *arraypaths = vlc_array_new();