From: RĂ©mi Denis-Courmont Date: Sun, 28 Sep 2008 17:18:01 +0000 (+0300) Subject: Move psz_vlcpath out of p_root X-Git-Tag: 1.0.0-pre1~2814 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b4f8c0f6a4b158e5dc824734ee23ce47a3f07ec2;p=vlc Move psz_vlcpath out of p_root --- diff --git a/src/config/dirs.c b/src/config/dirs.c index 5877b4b2f1..16cbf8134c 100644 --- a/src/config/dirs.c +++ b/src/config/dirs.c @@ -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; diff --git a/src/libvlc.h b/src/libvlc.h index 8b47fd408b..fbf1a02671 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -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. diff --git a/src/misc/beos_specific.cpp b/src/misc/beos_specific.cpp index f1a14d08f7..8dbec2e163 100644 --- a/src/misc/beos_specific.cpp +++ b/src/misc/beos_specific.cpp @@ -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 ); diff --git a/src/misc/darwin_specific.c b/src/misc/darwin_specific.c index 6e68ee1241..f751c63c8e 100644 --- a/src/misc/darwin_specific.c +++ b/src/misc/darwin_specific.c @@ -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 ); } diff --git a/src/misc/linux_specific.c b/src/misc/linux_specific.c index 0a4be0ad79..6dbf25eb7b 100644 --- a/src/misc/linux_specific.c +++ b/src/misc/linux_specific.c @@ -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"); diff --git a/src/misc/threads.c b/src/misc/threads.c index 32855d12c2..6d0865382a 100644 --- a/src/misc/threads.c +++ b/src/misc/threads.c @@ -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; diff --git a/src/misc/variables.c b/src/misc/variables.c index c524568ba1..37fcd798f9 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -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 ) ) diff --git a/src/misc/win32_specific.c b/src/misc/win32_specific.c index 1f027cc517..b89eabfefd 100644 --- a/src/misc/win32_specific.c +++ b/src/misc/win32_specific.c @@ -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 ) ) diff --git a/src/modules/modules.c b/src/modules/modules.c index 85b12ae992..ee036e3131 100644 --- a/src/modules/modules.c +++ b/src/modules/modules.c @@ -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();