(trunk libT) since messageLevel is a global variable, giving it a unique "tr_" prefix is a nice safeguard

This commit is contained in:
Charles Kerr 2010-12-31 01:30:35 +00:00
parent 20cdf0162a
commit 21ca9e7770
3 changed files with 13 additions and 16 deletions

View File

@ -756,8 +756,6 @@ tr_msg_level;
void tr_setMessageLevel( tr_msg_level );
tr_msg_level tr_getMessageLevel( void );
typedef struct tr_msg_list
{
/* TR_MSG_ERR, TR_MSG_INF, or TR_MSG_DBG */

View File

@ -63,9 +63,9 @@
#include "version.h"
time_t transmission_now = 0;
time_t __tr_current_time = 0;
tr_msg_level __tr_message_level = TR_MSG_ERR;
tr_msg_level messageLevel = TR_MSG_ERR;
static tr_bool messageQueuing = FALSE;
static tr_msg_list * messageQueue = NULL;
static tr_msg_list ** messageQueueTail = &messageQueue;
@ -124,13 +124,7 @@ tr_getLog( void )
void
tr_setMessageLevel( tr_msg_level level )
{
messageLevel = level;
}
tr_msg_level
tr_getMessageLevel( void )
{
return messageLevel;
__tr_message_level = level;
}
void

View File

@ -116,11 +116,16 @@ const char * tr_strip_positional_args( const char * fmt );
#define TR_MAX_MSG_LOG 10000
extern tr_msg_level messageLevel;
extern tr_msg_level __tr_message_level;
static inline tr_msg_level tr_getMessageLevel( void )
{
return __tr_message_level;
}
static inline tr_bool tr_msgLoggingIsActive( tr_msg_level level )
{
return messageLevel >= level;
return tr_getMessageLevel() >= level;
}
void tr_msg( const char * file, int line,
@ -531,7 +536,7 @@ void tr_removeElementFromArray( void * array,
***/
/** @brief Private libtransmission variable that's visible only for inlining in tr_time() */
extern time_t transmission_now;
extern time_t __tr_current_time;
/**
* @brief very inexpensive form of time(NULL)
@ -543,10 +548,10 @@ extern time_t transmission_now;
* to always be accurate. However, it is *much* faster when 100% accuracy
* isn't needed
*/
static inline time_t tr_time( void ) { return transmission_now; }
static inline time_t tr_time( void ) { return __tr_current_time; }
/** @brief Private libtransmission function to update tr_time()'s counter */
static inline void tr_timeUpdate( time_t now ) { transmission_now = now; }
static inline void tr_timeUpdate( time_t now ) { __tr_current_time = now; }
/** @brief Portability wrapper for realpath() that uses the system implementation if available */
char* tr_realpath( const char *path, char * resolved_path );