1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-03 01:31:53 +02:00

lua: PushCommand: Reduce locked scope

This commit is contained in:
Hugo Beauzée-Luyssen 2017-03-28 16:03:30 +02:00
parent ab515823f4
commit ce74108099

View File

@ -228,8 +228,6 @@ void KillExtension( extensions_manager_t *p_mgr, extension_t *p_ext )
int PushCommand__( extension_t *p_ext, bool b_unique, command_type_e i_command,
va_list args )
{
vlc_mutex_lock( &p_ext->p_sys->command_lock );
/* Create command */
struct command_t *cmd = calloc( 1, sizeof( struct command_t ) );
cmd->i_command = i_command;
@ -244,7 +242,6 @@ int PushCommand__( extension_t *p_ext, bool b_unique, command_type_e i_command,
if( !pi )
{
free( cmd );
vlc_mutex_unlock( &p_ext->p_sys->command_lock );
return VLC_ENOMEM;
}
*pi = va_arg( args, int );
@ -257,7 +254,6 @@ int PushCommand__( extension_t *p_ext, bool b_unique, command_type_e i_command,
if( !pi )
{
free( cmd );
vlc_mutex_unlock( &p_ext->p_sys->command_lock );
return VLC_ENOMEM;
}
*pi = va_arg( args, int );
@ -275,6 +271,8 @@ int PushCommand__( extension_t *p_ext, bool b_unique, command_type_e i_command,
break;
}
vlc_mutex_lock( &p_ext->p_sys->command_lock );
/* Push command to the end of the queue */
struct command_t *last = p_ext->p_sys->command;
if( !last )