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

Remove redumdant parameter to vlc_global

parent 7675aa3f
......@@ -210,8 +210,7 @@ VLC_EXPORT( module_t *, config_FindModule,( vlc_object_t *, const char * ) );
VLC_EXPORT( int, config_Duplicate,( module_t *, const module_config_t *, size_t ));
#define config_GetDataDir( a ) __config_GetDataDir( VLC_OBJECT( a ) )
VLC_EXPORT(const char *, __config_GetDataDir, ( const vlc_object_t * ));
VLC_EXPORT(const char *, config_GetDataDir, ( void ));
#define config_GetType(a,b) __config_GetType(VLC_OBJECT(a),b)
#define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b)
......
......@@ -109,7 +109,6 @@ VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
VLC_EXPORT( libvlc_int_t *, vlc_current_object, ( int ) );
VLC_EXPORT( vlc_object_t *, vlc_global_object, ( void ) );
/*}@*/
......
......@@ -290,7 +290,7 @@ static int Open( vlc_object_t *p_this )
#if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32)
if ( ( psz_src = config_GetPsz( p_intf, "http-src" )) == NULL )
{
char * psz_vlcpath = config_GetDataDir( p_intf );
const char * psz_vlcpath = config_GetDataDir();
psz_src = malloc( strlen(psz_vlcpath) + strlen("/http" ) + 1 );
if( !psz_src ) return VLC_ENOMEM;
sprintf( psz_src, "%s/http", psz_vlcpath );
......
......@@ -295,7 +295,7 @@ int E_(Import_LuaPlaylist)( vlc_object_t *p_this )
# if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32)
{
char *psz_vlcpath = config_GetDataDir( p_demux );
const char *psz_vlcpath = config_GetDataDir();
if( asprintf( &ppsz_dir_list[1], "%s" DIR_SEP "luaplaylist", psz_vlcpath ) < 0 )
return VLC_ENOMEM;
if( asprintf( &ppsz_dir_list[2], "%s" DIR_SEP "share" DIR_SEP "luaplaylist", psz_vlcpath ) < 0 )
......
......@@ -227,13 +227,13 @@ bool Win32Factory::init()
// Initialize the resource path
m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_homedir +
"\\" + CONFIG_DIR + "\\skins" );
m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) +
m_resourcePath.push_back( (string)config_GetDataDir() +
"\\skins" );
m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) +
m_resourcePath.push_back( (string)config_GetDataDir() +
"\\skins2" );
m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) +
m_resourcePath.push_back( (string)config_GetDataDir() +
"\\share\\skins" );
m_resourcePath.push_back( (string)config_GetDataDir( getIntf() ) +
m_resourcePath.push_back( (string)config_GetDataDir() +
"\\share\\skins2" );
// All went well
......
......@@ -301,7 +301,7 @@ static int vlclua_scripts_batch_execute( vlc_object_t *p_this,
# if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32)
{
const char *psz_vlcpath = config_GetDataDir( p_this );
const char *psz_vlcpath = config_GetDataDir();
if( asprintf( &ppsz_dir_list[1], "%s" DIR_SEP "%s", psz_vlcpath, luadirname ) < 0 )
return VLC_ENOMEM;
......
......@@ -704,7 +704,7 @@ gnutls_ClientCreate( tls_t *p_tls )
vlc_object_attach( p_session, p_tls );
const char *homedir = p_tls->p_libvlc->psz_homedir,
*datadir = config_GetDataDir ((vlc_object_t *)p_session);
*datadir = config_GetDataDir ();
size_t l1 = strlen (homedir), l2 = strlen (datadir);
char path[((l1 > l2) ? l1 : l2) + sizeof ("/"CONFIG_DIR"/ssl/private")];
// > sizeof ("/"CONFIG_DIR"/ssl/certs")
......
......@@ -90,8 +90,8 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
char *psz_vlmconf;
/* Avoid multiple creation */
if( var_Create( p_this->p_libvlc_global, "vlm_mutex", VLC_VAR_MUTEX ) ||
var_Get( p_this->p_libvlc_global, "vlm_mutex", &lockval ) )
if( var_Create( p_this->p_libvlc, "vlm_mutex", VLC_VAR_MUTEX ) ||
var_Get( p_this->p_libvlc, "vlm_mutex", &lockval ) )
return NULL;
vlc_mutex_lock( lockval.p_address );
......@@ -163,7 +163,7 @@ void vlm_Delete( vlm_t *p_vlm )
{
vlc_value_t lockval;
var_Get( p_vlm->p_libvlc_global, "vlm_mutex", &lockval );
var_Get( p_vlm->p_libvlc, "vlm_mutex", &lockval );
vlc_mutex_lock( lockval.p_address );
vlc_object_release( p_vlm );
......
......@@ -122,9 +122,9 @@ static int VerboseCallback( vlc_object_t *, char const *,
static void InitDeviceValues( libvlc_int_t * );
vlc_object_t * vlc_global_object( void )
libvlc_global_data_t *vlc_global( void )
{
return VLC_OBJECT( &libvlc_global );
return &libvlc_global;
}
/*****************************************************************************
......
......@@ -74,11 +74,7 @@ struct libvlc_global_data_t
#endif
};
#define vlc_global( a ) __vlc_global( VLC_OBJECT( a ) )
static inline libvlc_global_data_t *__vlc_global( vlc_object_t *p_this )
{
return (libvlc_global_data_t *)p_this->p_libvlc_global;
}
libvlc_global_data_t *vlc_global (void);
extern uint32_t cpu_flags;
uint32_t CPUCapabilities( void );
......
......@@ -4,7 +4,7 @@ sout_SessionSetMedia
vlc_b64_encode_binary
vlc_strnlen
stream_Block
__config_GetDataDir
config_GetDataDir
__vlc_object_find_name
__var_Command
net_Listen
......
......@@ -80,11 +80,11 @@ static void AppThread( vlc_object_t *p_appthread );
*****************************************************************************/
void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
{
vlc_global( p_this )->p_appthread =
vlc_global()->p_appthread =
(vlc_object_t *)vlc_object_create( p_this, sizeof(vlc_object_t) );
/* Create the BApplication thread and wait for initialization */
vlc_thread_create( vlc_global( p_this )->p_appthread, "app thread", AppThread,
vlc_thread_create( vlc_global()->p_appthread, "app thread", AppThread,
VLC_THREAD_PRIORITY_LOW, VLC_TRUE );
}
......@@ -103,10 +103,10 @@ void system_End( libvlc_int_t *p_this )
/* Tell the BApplication to die */
be_app->PostMessage( REALLY_QUIT );
vlc_thread_join( vlc_global( p_this )->p_appthread );
vlc_object_destroy( vlc_global( p_this )->p_appthread );
vlc_thread_join( vlc_global()->p_appthread );
vlc_object_destroy( vlc_global()->p_appthread );
free( vlc_global( p_this )->psz_vlcpath );
free( vlc_global()->psz_vlcpath );
}
/* following functions are local */
......@@ -173,7 +173,7 @@ void VlcApplication::ReadyToRun( )
BEntry entry( &info.ref );
entry.GetPath( &path );
path.GetParent( &path );
vlc_global( p_this )->psz_vlcpath = strdup( path.Path() );
vlc_global()->psz_vlcpath = strdup( path.Path() );
/* Tell the main thread we are finished initializing the BApplication */
vlc_thread_ready( p_this );
......
......@@ -71,7 +71,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
char *p_char, *p_oldchar = &i_dummy;
/* Get the full program path and name */
p_char = vlc_global( p_this )->psz_vlcpath = strdup( ppsz_argv[ 0 ] );
p_char = vlc_global()->psz_vlcpath = strdup( ppsz_argv[ 0 ] );
/* Remove trailing program name */
for( ; *p_char ; )
......@@ -117,8 +117,8 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
CFRelease( all_locales );
}
vlc_mutex_init( p_this, &vlc_global( p_this )->iconv_lock );
vlc_global( p_this )->iconv_macosx = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
vlc_mutex_init( p_this, &vlc_global()->iconv_lock );
vlc_global()->iconv_macosx = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
}
/*****************************************************************************
......@@ -134,10 +134,10 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
*****************************************************************************/
void system_End( libvlc_int_t *p_this )
{
free( vlc_global( p_this )->psz_vlcpath );
free( vlc_global()->psz_vlcpath );
if ( vlc_global( p_this )->iconv_macosx != (vlc_iconv_t)-1 )
vlc_iconv_close( vlc_global( p_this )->iconv_macosx );
vlc_mutex_destroy( &vlc_global( p_this )->iconv_lock );
if ( vlc_global()->iconv_macosx != (vlc_iconv_t)-1 )
vlc_iconv_close( vlc_global()->iconv_macosx );
vlc_mutex_destroy( &vlc_global()->iconv_lock );
}
......@@ -160,7 +160,7 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
}
else
{
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
p_new->p_libvlc_global = VLC_OBJECT (p_libvlc_global);
p_new->p_libvlc = ( i_type == VLC_OBJECT_LIBVLC ) ? (libvlc_int_t*)p_new
: p_this->p_libvlc;
......@@ -414,7 +414,7 @@ void __vlc_object_destroy( vlc_object_t *p_this )
}
else
{
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
int i_index;
vlc_mutex_lock( &structure_lock );
......@@ -473,7 +473,7 @@ void * __vlc_object_get( vlc_object_t *p_this, int i_id )
{
int i_max, i_middle;
vlc_object_t **pp_objects;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
vlc_mutex_lock( &structure_lock );
......@@ -722,7 +722,7 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
vlc_list_t *p_list;
vlc_object_t **pp_current, **pp_end;
int i_count = 0, i_index = 0;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
vlc_mutex_lock( &structure_lock );
......@@ -793,7 +793,7 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
(void)oldval; (void)p_data;
if( *psz_cmd == 'l' )
......
......@@ -290,7 +290,7 @@ void __stats_TimerStart( vlc_object_t *p_obj, const char *psz_name,
if( !p_counter )
{
counter_sample_t *p_sample;
p_counter = stats_CounterCreate( p_obj->p_libvlc_global, VLC_VAR_TIME,
p_counter = stats_CounterCreate( p_obj->p_libvlc, VLC_VAR_TIME,
STATS_TIMER );
if( !p_counter )
{
......
......@@ -30,6 +30,7 @@
#ifdef HAVE_STDLIB_H
# include <stdlib.h> /* realloc() */
#endif
#include "libvlc.h"
/*****************************************************************************
* Private types
......@@ -834,7 +835,7 @@ int __var_Get( vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val )
*/
vlc_mutex_t *var_GetGlobalMutex( const char *name )
{
vlc_object_t *p_global = vlc_global_object();
libvlc_global_data_t *p_global = vlc_global();
vlc_value_t val;
if( var_Create( p_global, name, VLC_VAR_MUTEX ) )
......
......@@ -86,7 +86,7 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
}
#endif
vlc_global( p_this )->psz_vlcpath = strdup( psz_path );
vlc_global()->psz_vlcpath = strdup( psz_path );
/* Set the default file-translation mode */
#if !defined( UNDER_CE )
......@@ -362,10 +362,10 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
*****************************************************************************/
void system_End( libvlc_int_t *p_this )
{
if( p_this && p_this->p_libvlc_global && vlc_global( p_this )->psz_vlcpath )
if( p_this && vlc_global() )
{
free( vlc_global( p_this )->psz_vlcpath );
vlc_global( p_this )->psz_vlcpath = NULL;
free( vlc_global()->psz_vlcpath );
vlc_global()->psz_vlcpath = NULL;
}
WSACleanup();
......
......@@ -1705,22 +1705,21 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
*
* @return a string (always succeeds).
*/
const char *__config_GetDataDir( const vlc_object_t *p_this )
const char *config_GetDataDir( void )
{
#if defined (WIN32) || defined (UNDER_CE)
return vlc_global( p_this )->psz_vlcpath;
return vlc_global()->psz_vlcpath;
#elif defined(__APPLE__) || defined (SYS_BEOS)
static char path[PATH_MAX] = "";
if( *path == '\0' )
{
snprintf( path, sizeof( path ), "%s/share",
vlc_global( p_this )->psz_vlcpath );
vlc_global()->psz_vlcpath );
path[sizeof( path ) - 1] = '\0';
}
return path;
#else
(void)p_this;
return DATA_PATH;
#endif
}
......
......@@ -171,7 +171,7 @@ void __module_InitBank( vlc_object_t *p_this )
{
module_bank_t *p_bank = NULL;
vlc_value_t lockval;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
......@@ -214,7 +214,7 @@ void __module_EndBank( vlc_object_t *p_this )
{
module_t * p_next = NULL;
vlc_value_t lockval;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
......@@ -302,7 +302,7 @@ void __module_EndBank( vlc_object_t *p_this )
static void module_LoadMain( vlc_object_t *p_this )
{
vlc_value_t lockval;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
......@@ -328,7 +328,7 @@ static void module_LoadMain( vlc_object_t *p_this )
void __module_LoadBuiltins( vlc_object_t * p_this )
{
vlc_value_t lockval;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
......@@ -356,7 +356,7 @@ void __module_LoadPlugins( vlc_object_t * p_this )
{
#ifdef HAVE_DYNAMIC_PLUGINS
vlc_value_t lockval;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
......@@ -830,7 +830,7 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
#endif
{
if( 0>= asprintf( &psz_fullpath, "%s"DIR_SEP"%s",
vlc_global( p_this )->psz_vlcpath, *ppsz_path) )
vlc_global()->psz_vlcpath, *ppsz_path) )
psz_fullpath = NULL;
}
else
......@@ -1092,7 +1092,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, char * psz_file,
if( p_module )
{
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
/* Everything worked fine !
* The module is ready to be added to the list. */
......@@ -1277,7 +1277,7 @@ static int AllocateBuiltinModule( vlc_object_t * p_this,
/* msg_Dbg( p_this, "builtin \"%s\", %s",
p_module->psz_object_name, p_module->psz_longname ); */
vlc_object_attach( p_module, vlc_global( p_this )->p_module_bank );
vlc_object_attach( p_module, vlc_global()->p_module_bank );
return 0;
}
......@@ -1653,7 +1653,7 @@ static void CacheLoad( vlc_object_t *p_this )
int i_cache;
module_cache_t **pp_cache = 0;
int32_t i_file_size, i_marker;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
psz_homedir = p_this->p_libvlc->psz_homedir;
if( !psz_homedir )
......@@ -2007,7 +2007,7 @@ static void CacheSave( vlc_object_t *p_this )
int i, j, i_cache;
module_cache_t **pp_cache;
int32_t i_file_size = 0;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
psz_homedir = p_this->p_libvlc->psz_homedir;
if( !psz_homedir )
......@@ -2254,7 +2254,7 @@ static module_cache_t *CacheFind( vlc_object_t *p_this, char *psz_file,
{
module_cache_t **pp_cache;
int i_cache, i;
libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
libvlc_global_data_t *p_libvlc_global = vlc_global();
pp_cache = p_libvlc_global->p_module_bank->pp_loaded_cache;
i_cache = p_libvlc_global->p_module_bank->i_loaded_cache;
......
......@@ -996,8 +996,8 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
}
/* to be sure to avoid multiple creation */
var_Create( p_this->p_libvlc_global, "httpd_mutex", VLC_VAR_MUTEX );
var_Get( p_this->p_libvlc_global, "httpd_mutex", &lockval );
var_Create( p_this->p_libvlc, "httpd_mutex", VLC_VAR_MUTEX );
var_Get( p_this->p_libvlc, "httpd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address );
if( !(httpd = vlc_object_find( p_this, VLC_OBJECT_HTTPD, FIND_ANYWHERE )) )
......@@ -1138,7 +1138,7 @@ void httpd_HostDelete( httpd_host_t *host )
vlc_value_t lockval;
int i;
var_Get( httpd->p_libvlc_global, "httpd_mutex", &lockval );
var_Get( httpd->p_libvlc, "httpd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address );
host->i_ref--;
......
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