This commit is contained in:
larryh%netscape.com 1999-10-19 00:15:05 +00:00
Родитель 87878548b8
Коммит d2cecca1dc
2 изменённых файлов: 2 добавлений и 26 удалений

Просмотреть файл

@ -95,7 +95,6 @@ static PRLock *_pr_logLock;
static PRLogModuleInfo *logModules; static PRLogModuleInfo *logModules;
#ifdef PR_LOGGING
static char *logBuf = NULL; static char *logBuf = NULL;
static char *logp; static char *logp;
static char *logEndp; static char *logEndp;
@ -245,11 +244,9 @@ void _PR_LogCleanup(void)
#endif #endif
} }
#endif /* PR_LOGGING */
static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm ) static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm )
{ {
#ifdef PR_LOGGING
char *ev; char *ev;
ev = PR_GetEnv("NSPR_LOG_MODULES"); ev = PR_GetEnv("NSPR_LOG_MODULES");
@ -281,7 +278,6 @@ static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm )
if (count == -1) break; if (count == -1) break;
} }
} }
#endif /* PR_LOGGING */
} /* end _PR_SetLogModuleLevel() */ } /* end _PR_SetLogModuleLevel() */
PR_IMPLEMENT(PRLogModuleInfo*) PR_NewLogModule(const char *name) PR_IMPLEMENT(PRLogModuleInfo*) PR_NewLogModule(const char *name)
@ -303,7 +299,6 @@ PR_IMPLEMENT(PRLogModuleInfo*) PR_NewLogModule(const char *name)
PR_IMPLEMENT(PRBool) PR_SetLogFile(const char *file) PR_IMPLEMENT(PRBool) PR_SetLogFile(const char *file)
{ {
#ifdef PR_LOGGING
#ifdef _PR_USE_STDIO_FOR_LOGGING #ifdef _PR_USE_STDIO_FOR_LOGGING
FILE *newLogFile; FILE *newLogFile;
@ -339,15 +334,10 @@ PR_IMPLEMENT(PRBool) PR_SetLogFile(const char *file)
} }
return (PRBool) (newLogFile != 0); return (PRBool) (newLogFile != 0);
#endif /* _PR_USE_STDIO_FOR_LOGGING */ #endif /* _PR_USE_STDIO_FOR_LOGGING */
#else /* PR_LOGGING */
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FALSE;
#endif /* PR_LOGGING */
} }
PR_IMPLEMENT(void) PR_SetLogBuffering(PRIntn buffer_size) PR_IMPLEMENT(void) PR_SetLogBuffering(PRIntn buffer_size)
{ {
#ifdef PR_LOGGING
PR_LogFlush(); PR_LogFlush();
if (logBuf) if (logBuf)
@ -358,12 +348,10 @@ PR_IMPLEMENT(void) PR_SetLogBuffering(PRIntn buffer_size)
logp = logBuf = (char*) PR_MALLOC(buffer_size); logp = logBuf = (char*) PR_MALLOC(buffer_size);
logEndp = logp + buffer_size; logEndp = logp + buffer_size;
} }
#endif /* PR_LOGGING */
} }
PR_IMPLEMENT(void) PR_LogPrint(const char *fmt, ...) PR_IMPLEMENT(void) PR_LogPrint(const char *fmt, ...)
{ {
#ifdef PR_LOGGING
va_list ap; va_list ap;
char line[LINE_BUF_SIZE]; char line[LINE_BUF_SIZE];
PRUint32 nb; PRUint32 nb;
@ -424,12 +412,10 @@ PR_IMPLEMENT(void) PR_LogPrint(const char *fmt, ...)
} }
_PR_UNLOCK_LOG(); _PR_UNLOCK_LOG();
PR_LogFlush(); PR_LogFlush();
#endif /* PR_LOGGING */
} }
PR_IMPLEMENT(void) PR_LogFlush(void) PR_IMPLEMENT(void) PR_LogFlush(void)
{ {
#ifdef PR_LOGGING
if (logBuf && logFile) { if (logBuf && logFile) {
_PR_LOCK_LOG(); _PR_LOCK_LOG();
if (logp > logBuf) { if (logp > logBuf) {
@ -438,21 +424,17 @@ PR_IMPLEMENT(void) PR_LogFlush(void)
} }
_PR_UNLOCK_LOG(); _PR_UNLOCK_LOG();
} }
#endif /* PR_LOGGING */
} }
PR_IMPLEMENT(void) PR_Abort(void) PR_IMPLEMENT(void) PR_Abort(void)
{ {
#ifdef PR_LOGGING
PR_LogPrint("Aborting"); PR_LogPrint("Aborting");
abort(); abort();
#endif /* PR_LOGGING */
PR_ASSERT(1);
} }
PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln) PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln)
{ {
#ifdef PR_LOGGING #ifdef DEBUG
PR_LogPrint("Assertion failure: %s, at %s:%d\n", s, file, ln); PR_LogPrint("Assertion failure: %s, at %s:%d\n", s, file, ln);
#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln); fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
@ -466,14 +448,12 @@ PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln)
#ifndef XP_MAC #ifndef XP_MAC
abort(); abort();
#endif #endif
#endif /* PR_LOGGING */ #endif /* DEBUG */
} }
#ifdef XP_MAC #ifdef XP_MAC
PR_IMPLEMENT(void) PR_Init_Log(void) PR_IMPLEMENT(void) PR_Init_Log(void)
{ {
#ifdef PR_LOGGING
_PR_InitLog(); _PR_InitLog();
#endif
} }
#endif #endif

Просмотреть файл

@ -195,9 +195,7 @@ static void _PR_InitStuff(void)
_PR_InitCMon(); _PR_InitCMon();
_PR_InitIO(); _PR_InitIO();
_PR_InitNet(); _PR_InitNet();
#ifdef PR_LOGGING
_PR_InitLog(); _PR_InitLog();
#endif
_PR_InitLinker(); _PR_InitLinker();
_PR_InitCallOnce(); _PR_InitCallOnce();
_PR_InitDtoa(); _PR_InitDtoa();
@ -385,9 +383,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
PR_LOG(_pr_thread_lm, PR_LOG_MIN, PR_LOG(_pr_thread_lm, PR_LOG_MIN,
("PR_Cleanup: clean up before destroying thread")); ("PR_Cleanup: clean up before destroying thread"));
#ifdef PR_LOGGING
_PR_LogCleanup(); _PR_LogCleanup();
#endif
_PR_CleanupFdCache(); _PR_CleanupFdCache();
/* /*