* logger.c : file logging plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: logger.c,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * $Id: logger.c,v 1.2 2002/08/24 17:04:36 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
/* Open the log file and remove any buffering for the stream */
msg_Dbg( p_intf, "opening logfile `%s'", psz_file );
p_intf->p_sys->p_file = fopen( psz_file, "wt" );
- setvbuf( p_intf->p_sys->p_file, NULL, _IONBF, 0 );
-
- p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
-
if( p_intf->p_sys->p_file == NULL )
{
msg_Err( p_intf, "error opening logfile `%s'", psz_file );
free( p_intf->p_sys );
- msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
free( psz_file );
return -1;
}
+ setvbuf( p_intf->p_sys->p_file, NULL, _IONBF, 0 );
+ p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
free( psz_file );
break;
}
+ p_intf->pf_run = Run;
+
return 0;
}
* objects.c: vlc_object_t handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: objects.c,v 1.19 2002/08/15 12:11:15 sam Exp $
+ * $Id: objects.c,v 1.20 2002/08/24 17:04:36 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
msleep( 100000 );
}
- vlc_mutex_lock( &p_this->p_vlc->structure_lock );
-
/* Wooohaa! If *this* fails, we're in serious trouble! Anyway it's
* useless to try and recover anything if pp_objects gets smashed. */
- if( p_this->p_vlc->i_objects > 1 )
+ if( p_this->i_object_type != VLC_OBJECT_ROOT )
{
- int i_index = FindIndex( p_this, p_this->p_vlc->pp_objects,
- p_this->p_vlc->i_objects );
+ int i_index;
+
+ vlc_mutex_lock( &p_this->p_vlc->structure_lock );
+
+ i_index = FindIndex( p_this, p_this->p_vlc->pp_objects,
+ p_this->p_vlc->i_objects );
memmove( p_this->p_vlc->pp_objects + i_index,
p_this->p_vlc->pp_objects + i_index + 1,
(p_this->p_vlc->i_objects - i_index - 1)
p_this->p_vlc->pp_objects =
realloc( p_this->p_vlc->pp_objects,
(p_this->p_vlc->i_objects - 1) * sizeof(vlc_object_t *) );
+
+ vlc_mutex_unlock( &p_this->p_vlc->structure_lock );
}
else
{
+ /* We are the root object ... no need to lock. */
free( p_this->p_vlc->pp_objects );
p_this->p_vlc->pp_objects = NULL;
}
p_this->p_vlc->i_objects--;
- vlc_mutex_unlock( &p_this->p_vlc->structure_lock );
-
vlc_mutex_destroy( &p_this->object_lock );
vlc_cond_destroy( &p_this->object_wait );