summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/src/io/prlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub/pr/src/io/prlog.c')
-rw-r--r--nsprpub/pr/src/io/prlog.c52
1 files changed, 35 insertions, 17 deletions
diff --git a/nsprpub/pr/src/io/prlog.c b/nsprpub/pr/src/io/prlog.c
index 6098460ed..52bd6abc5 100644
--- a/nsprpub/pr/src/io/prlog.c
+++ b/nsprpub/pr/src/io/prlog.c
@@ -166,8 +166,9 @@ PRIntn strcasecmp(const char *a, const char *b)
const unsigned char *ua = (const unsigned char *)a;
const unsigned char *ub = (const unsigned char *)b;
- if( ((const char *)0 == a) || (const char *)0 == b )
+ if( ((const char *)0 == a) || (const char *)0 == b ) {
return (PRIntn)(a-b);
+ }
while( (uc[*ua] == uc[*ub]) && ('\0' != *a) )
{
@@ -201,7 +202,9 @@ void _PR_InitLog(void)
count = sscanf(&ev[pos], "%63[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-]%n:%d%n",
module, &delta, &level, &delta);
pos += delta;
- if (count == 0) break;
+ if (count == 0) {
+ break;
+ }
/*
** If count == 2, then we got module and level. If count
@@ -223,7 +226,9 @@ void _PR_InitLog(void)
(0 == strcasecmp (module, "all")) ? PR_TRUE : PR_FALSE;
while (lm != NULL) {
- if (skip_modcheck) lm -> level = (PRLogModuleLevel)level;
+ if (skip_modcheck) {
+ lm -> level = (PRLogModuleLevel)level;
+ }
else if (strcasecmp(module, lm->name) == 0) {
lm->level = (PRLogModuleLevel)level;
break;
@@ -234,7 +239,9 @@ void _PR_InitLog(void)
/*found:*/
count = sscanf(&ev[pos], " , %n", &delta);
pos += delta;
- if (count == EOF) break;
+ if (count == EOF) {
+ break;
+ }
}
PR_SetLogBuffering(isSync ? 0 : bufSize);
@@ -274,7 +281,7 @@ void _PR_LogCleanup(void)
#ifdef XP_PC
&& logFile != WIN32_DEBUG_FILE
#endif
- ) {
+ ) {
fclose(logFile);
}
#else
@@ -284,8 +291,9 @@ void _PR_LogCleanup(void)
#endif
logFile = NULL;
- if (logBuf)
+ if (logBuf) {
PR_DELETE(logBuf);
+ }
while (lm != NULL) {
PRLogModuleInfo *next = lm->next;
@@ -318,7 +326,9 @@ static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm )
count = sscanf(&ev[pos], "%63[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-]%n:%d%n",
module, &delta, &level, &delta);
pos += delta;
- if (count == 0) break;
+ if (count == 0) {
+ break;
+ }
/*
** If count == 2, then we got module and level. If count
@@ -334,7 +344,9 @@ static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm )
}
count = sscanf(&ev[pos], " , %n", &delta);
pos += delta;
- if (count == EOF) break;
+ if (count == EOF) {
+ break;
+ }
}
}
} /* end _PR_SetLogModuleLevel() */
@@ -343,7 +355,9 @@ PR_IMPLEMENT(PRLogModuleInfo*) PR_NewLogModule(const char *name)
{
PRLogModuleInfo *lm;
- if (!_pr_initialized) _PR_ImplicitInitialization();
+ if (!_pr_initialized) {
+ _PR_ImplicitInitialization();
+ }
lm = PR_NEWZAP(PRLogModuleInfo);
if (lm) {
@@ -371,8 +385,9 @@ PR_IMPLEMENT(PRBool) PR_SetLogFile(const char *file)
{
const char *mode = appendToLog ? "a" : "w";
newLogFile = fopen(file, mode);
- if (!newLogFile)
+ if (!newLogFile) {
return PR_FALSE;
+ }
#ifndef WINCE /* _IONBF does not exist in the Windows Mobile 6 SDK. */
/* We do buffering ourselves. */
@@ -385,7 +400,7 @@ PR_IMPLEMENT(PRBool) PR_SetLogFile(const char *file)
#ifdef XP_PC
&& logFile != WIN32_DEBUG_FILE
#endif
- ) {
+ ) {
fclose(logFile);
}
logFile = newLogFile;
@@ -414,8 +429,9 @@ PR_IMPLEMENT(void) PR_SetLogBuffering(PRIntn buffer_size)
{
PR_LogFlush();
- if (logBuf)
+ if (logBuf) {
PR_DELETE(logBuf);
+ }
if (buffer_size >= LINE_BUF_SIZE) {
logp = logBuf = (char*) PR_MALLOC(buffer_size);
@@ -432,7 +448,9 @@ PR_IMPLEMENT(void) PR_LogPrint(const char *fmt, ...)
PRThread *me;
PRExplodedTime now;
- if (!_pr_initialized) _PR_ImplicitInitialization();
+ if (!_pr_initialized) {
+ _PR_ImplicitInitialization();
+ }
if (!logFile) {
return;
@@ -520,10 +538,10 @@ PR_IMPLEMENT(void) PR_LogFlush(void)
{
if (logBuf && logFile) {
_PR_LOCK_LOG();
- if (logp > logBuf) {
- _PUT_LOG(logFile, logBuf, logp - logBuf);
- logp = logBuf;
- }
+ if (logp > logBuf) {
+ _PUT_LOG(logFile, logBuf, logp - logBuf);
+ logp = logBuf;
+ }
_PR_UNLOCK_LOG();
}
}