Ignore:
Timestamp:
Sep 22, 2010, 3:17:16 PM (11 years ago)
Author:
charles
Message:

(trunk daemon) #3511, part 2 of 2: get rid of the TR_DEBUG environment variable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r11228 r11250  
    6363time_t transmission_now = 0;
    6464
    65 tr_msg_level messageLevel = TR_MSG_INF;
    66 static tr_lock *      messageLock = NULL;
     65tr_msg_level messageLevel = TR_MSG_ERR;
    6766static tr_bool        messageQueuing = FALSE;
    6867static tr_msg_list *  messageQueue = NULL;
     
    8079***/
    8180
    82 void
    83 tr_msgInit( void )
    84 {
    85     const char * env = getenv( "TR_DEBUG" );
    86     messageLevel = ( env ? atoi( env ) : 0 ) + 1;
    87     messageLevel = MAX( 1, messageLevel );
    88 
    89     if( messageLock == NULL )
    90         messageLock = tr_lockNew( );
     81static tr_lock*
     82getMessageLock( void )
     83{
     84    static tr_lock * l = NULL;
     85
     86    if( !l )
     87        l = tr_lockNew( );
     88
     89    return l;
    9190}
    9291
     
    148147{
    149148    tr_msg_list * ret;
    150     tr_lockLock( messageLock );
     149    tr_lockLock( getMessageLock( ) );
    151150
    152151    ret = messageQueue;
     
    156155    messageQueueCount = 0;
    157156
    158     tr_lockUnlock( messageLock );
     157    tr_lockUnlock( getMessageLock( ) );
    159158    return ret;
    160159}
     
    269268    char buf[1024];
    270269    va_list ap;
    271 
    272     if( messageLock != NULL )
    273         tr_lockLock( messageLock );
     270    tr_lockLock( getMessageLock( ) );
    274271
    275272    /* build the text message */
     
    329326    }
    330327
    331     if( messageLock != NULL )
    332         tr_lockUnlock( messageLock );
    333 
     328    tr_lockUnlock( getMessageLock( ) );
    334329    errno = err;
    335330}
Note: See TracChangeset for help on using the changeset viewer.