Commit b4f8c0f6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Move psz_vlcpath out of p_root

parent 87868182
......@@ -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;
......
......@@ -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.
......
......@@ -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 );
......
......@@ -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 );
}
......@@ -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");
......
......@@ -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;
......
......@@ -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 ) )
......
......@@ -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 ) )
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment