From 80cb294832cf77b8440957d75d24cae2ec853d0c Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 28 Sep 2008 20:33:54 +0300 Subject: [PATCH] Remove vlc_global() --- src/libvlc.h | 1 - src/misc/threads.c | 24 ++++++++++++++++++------ src/misc/variables.c | 19 ------------------- src/misc/win32_specific.c | 2 +- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/libvlc.h b/src/libvlc.h index fbf1a02671..6ff2e23af1 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -146,7 +146,6 @@ __vlc_custom_create (vlc_object_t *p_this, size_t i_size, int i_type, */ extern module_bank_t *p_module_bank; -vlc_object_t *vlc_global (void); extern char *psz_vlcpath; /** diff --git a/src/misc/threads.c b/src/misc/threads.c index 68472bb232..3a784a093e 100644 --- a/src/misc/threads.c +++ b/src/misc/threads.c @@ -59,12 +59,6 @@ static vlc_threadvar_t cancel_key; */ static vlc_object_t *p_root; -vlc_object_t *vlc_global( void ) -{ - assert( i_initializations > 0 ); - return p_root; -} - #ifdef HAVE_EXECINFO_H # include #endif @@ -1110,3 +1104,21 @@ void vlc_control_cancel (int cmd, ...) va_end (ap); #endif } + + +#undef var_AcquireMutex +/** + * Finds a process-wide mutex, creates it if needed, and locks it. + * Unlock with vlc_mutex_unlock(). + */ +vlc_mutex_t *var_AcquireMutex( const char *name ) +{ + vlc_value_t val; + + if( var_Create( p_root, name, VLC_VAR_MUTEX ) ) + return NULL; + + var_Get( p_root, name, &val ); + vlc_mutex_lock( val.p_address ); + return val.p_address; +} diff --git a/src/misc/variables.c b/src/misc/variables.c index 37fcd798f9..4a6d8e908d 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -849,25 +849,6 @@ int __var_Get( vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val ) } -#undef var_AcquireMutex -/** - * Finds a process-wide mutex, creates it if needed, and locks it. - * Unlock with vlc_mutex_unlock(). - */ -vlc_mutex_t *var_AcquireMutex( const char *name ) -{ - vlc_object_t *p_global = vlc_global(); - vlc_value_t val; - - if( var_Create( p_global, name, VLC_VAR_MUTEX ) ) - return NULL; - - var_Get( p_global, name, &val ); - vlc_mutex_lock( val.p_address ); - return val.p_address; -} - - /** * Register a callback in a variable * diff --git a/src/misc/win32_specific.c b/src/misc/win32_specific.c index b89eabfefd..8daf1fa0a9 100644 --- a/src/misc/win32_specific.c +++ b/src/misc/win32_specific.c @@ -369,7 +369,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam, void system_End( libvlc_int_t *p_this ) { HWND ipcwindow; - if( p_this && vlc_global() ) + if( p_this ) { free( psz_vlcpath ); psz_vlcpath = NULL; -- 2.39.2