-#if !defined(HAVE_VASPRINTF) || defined(__APPLE__) || defined(SYS_BEOS)
- vlc_va_copy( args, _args );
- vsnprintf( psz_str, i_size, psz_format, args );
- va_end( args );
- psz_str[ i_size - 1 ] = 0; /* Just in case */
-#endif
-
- /* Put message in queue */
- vlc_mutex_lock( &p_bank->lock );
- for( i = 0 ; i <p_bank->i_queues ;i++ )
- {
- if( p_bank->pp_queues[i]->i_id == i_queue_id )
- {
- p_queue = p_bank->pp_queues[i];
- }
- }
-
- if( p_queue == NULL )
- {
- vlc_mutex_unlock( &p_bank->lock );
- if( psz_str ) free( psz_str );
- if( psz_header ) free( psz_header );
- return;
- }
-
- vlc_mutex_lock( &p_queue->lock );
-
- /* Check there is room in the queue for our message */
- if( p_queue->b_overflow )
- {
- FlushMsg( p_queue );
-
- if( ((p_queue->i_stop - p_queue->i_start + 1) % VLC_MSG_QSIZE) == 0 )
- {
- /* Still in overflow mode, print from a dummy item */
- p_item = &item;
- }
- else
- {
- /* Pheeew, at last, there is room in the queue! */
- p_queue->b_overflow = VLC_FALSE;
- }
- }
- else if( ((p_queue->i_stop - p_queue->i_start + 2) % VLC_MSG_QSIZE) == 0 )
- {
- FlushMsg( p_queue );
-
- if( ((p_queue->i_stop - p_queue->i_start + 2) % VLC_MSG_QSIZE) == 0 )
- {
- p_queue->b_overflow = VLC_TRUE;
-
- if( p_queue->i_id == MSG_QUEUE_NORMAL )
- {
- /* Put the overflow message in the queue */
- p_item = p_queue->msg + p_queue->i_stop;
- p_queue->i_stop = (p_queue->i_stop + 1) % VLC_MSG_QSIZE;
-
- p_item->i_type = VLC_MSG_WARN;
- p_item->i_object_id = p_this->i_object_id;
- p_item->i_object_type = p_this->i_object_type;
- p_item->psz_module = strdup( "message" );
- p_item->psz_msg = strdup( "message queue overflowed" );
- p_item->psz_header = NULL;
-
- PrintMsg( p_this, p_item );
- /* We print from a dummy item */
- p_item = &item;
- }
- }
- }
-
- if( !p_queue->b_overflow )
- {
- /* Put the message in the queue */
- p_item = p_queue->msg + p_queue->i_stop;
- p_queue->i_stop = (p_queue->i_stop + 1) % VLC_MSG_QSIZE;
- }
-