Commit 4be97e2d authored by Ian Craggs's avatar Ian Craggs

Compile warnings in StackTrace.c and locking scope in Log.c

parent be218ab6
...@@ -324,7 +324,6 @@ static void Log_output(int log_level, char* msg) ...@@ -324,7 +324,6 @@ static void Log_output(int log_level, char* msg)
{ {
if (trace_destination) if (trace_destination)
{ {
Thread_lock_mutex(log_mutex); /* need to lock around the fiddling with the log files */
fprintf(trace_destination, "%s\n", msg); fprintf(trace_destination, "%s\n", msg);
if (trace_destination != stdout && ++lines_written >= max_lines_per_file) if (trace_destination != stdout && ++lines_written >= max_lines_per_file)
...@@ -340,7 +339,6 @@ static void Log_output(int log_level, char* msg) ...@@ -340,7 +339,6 @@ static void Log_output(int log_level, char* msg)
} }
else else
fflush(trace_destination); fflush(trace_destination);
Thread_unlock_mutex(log_mutex);
} }
if (trace_callback) if (trace_callback)
...@@ -393,13 +391,14 @@ static void Log_trace(int log_level, char* buf) ...@@ -393,13 +391,14 @@ static void Log_trace(int log_level, char* buf)
*/ */
void Log(int log_level, int msgno, char* format, ...) void Log(int log_level, int msgno, char* format, ...)
{ {
char* temp = NULL;
static char msg_buf[512];
if (log_level >= trace_settings.trace_level) if (log_level >= trace_settings.trace_level)
{ {
char* temp = NULL;
static char msg_buf[512];
va_list args; va_list args;
/* we're using a static character buffer, so we need to make sure only one thread uses it at a time */
Thread_lock_mutex(log_mutex);
if (format == NULL && (temp = Messages_get(msgno, log_level)) != NULL) if (format == NULL && (temp = Messages_get(msgno, log_level)) != NULL)
format = temp; format = temp;
...@@ -408,6 +407,7 @@ void Log(int log_level, int msgno, char* format, ...) ...@@ -408,6 +407,7 @@ void Log(int log_level, int msgno, char* format, ...)
Log_trace(log_level, msg_buf); Log_trace(log_level, msg_buf);
va_end(args); va_end(args);
Thread_unlock_mutex(log_mutex);
} }
/*if (log_level >= LOG_ERROR) /*if (log_level >= LOG_ERROR)
...@@ -415,9 +415,7 @@ void Log(int log_level, int msgno, char* format, ...) ...@@ -415,9 +415,7 @@ void Log(int log_level, int msgno, char* format, ...)
char* filename = NULL; char* filename = NULL;
Log_recordFFDC(&msg_buf[7]); Log_recordFFDC(&msg_buf[7]);
} }
*/
if (log_level == LOG_FATAL)
exit(-1);*/
} }
......
...@@ -45,14 +45,14 @@ BE*/ ...@@ -45,14 +45,14 @@ BE*/
typedef struct typedef struct
{ {
unsigned long threadid; thread_id_type threadid;
char name[MAX_FUNCTION_NAME_LENGTH]; char name[MAX_FUNCTION_NAME_LENGTH];
int line; int line;
} stackEntry; } stackEntry;
typedef struct typedef struct
{ {
unsigned long id; thread_id_type id;
int maxdepth; int maxdepth;
int current_depth; int current_depth;
stackEntry callstack[MAX_STACK_DEPTH]; stackEntry callstack[MAX_STACK_DEPTH];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment