diff options
Diffstat (limited to 'src/debug.c')
-rw-r--r-- | src/debug.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/debug.c b/src/debug.c index 6527abd..4c64ff1 100644 --- a/src/debug.c +++ b/src/debug.c @@ -22,7 +22,9 @@ /*************************************************************************** * Emit a message. ***************************************************************************/ -void Debug(const char *str, ...) { +void +Debug(const char *str, ...) +{ #ifdef DEBUG va_list ap; va_start(ap, str); @@ -74,7 +76,9 @@ static void DEBUG_PrintResourceStack(ResourceType *rp); /*************************************************************************** * Start the debugger. ***************************************************************************/ -void DEBUG_StartDebug(const char *file, unsigned int line) { +void +DEBUG_StartDebug(const char *file, unsigned int line) +{ int x; Debug("%s[%u]: debug mode started", file, line); @@ -90,7 +94,9 @@ void DEBUG_StartDebug(const char *file, unsigned int line) { /*************************************************************************** * Stop the debugger. ***************************************************************************/ -void DEBUG_StopDebug(const char *file, unsigned int line) { +void +DEBUG_StopDebug(const char *file, unsigned int line) +{ MemoryType *mp; ResourceType *rp; unsigned int count = 0; @@ -128,7 +134,9 @@ void DEBUG_StopDebug(const char *file, unsigned int line) { /*************************************************************************** * Print the resource allocation/release stacks for a resource. ***************************************************************************/ -void DEBUG_PrintResourceStack(ResourceType *rp) { +void +DEBUG_PrintResourceStack(ResourceType *rp) +{ unsigned int x, offset; Debug(" Allocation stack: (oldest)"); @@ -154,7 +162,9 @@ void DEBUG_PrintResourceStack(ResourceType *rp) { /*************************************************************************** * Set a checkpoint. ***************************************************************************/ -void DEBUG_SetCheckpoint(const char *file, unsigned int line) { +void +DEBUG_SetCheckpoint(const char *file, unsigned int line) +{ checkpointFile[checkpointOffset] = file; checkpointLine[checkpointOffset] = line; @@ -166,7 +176,9 @@ void DEBUG_SetCheckpoint(const char *file, unsigned int line) { /*************************************************************************** * Display the location of the last checkpoint. ***************************************************************************/ -void DEBUG_ShowCheckpoint() { +void +DEBUG_ShowCheckpoint() +{ int x, offset; Debug("CHECKPOINT LIST (oldest)"); @@ -284,7 +296,9 @@ void *DEBUG_Reallocate(void *ptr, size_t size, const char *file, /*************************************************************************** * Release memory and log. ***************************************************************************/ -void DEBUG_Release(void **ptr, const char *file, unsigned int line) { +void +DEBUG_Release(void **ptr, const char *file, unsigned int line) +{ MemoryType *mp, *last; if(!ptr) { @@ -328,8 +342,10 @@ void DEBUG_Release(void **ptr, const char *file, unsigned int line) { /*************************************************************************** * Add a resource. ***************************************************************************/ -void DEBUG_AllocateResource(int resource, const char *file, - unsigned int line) { +void +DEBUG_AllocateResource(int resource, const char *file, + unsigned int line) +{ ResourceType *rp; @@ -363,8 +379,10 @@ void DEBUG_AllocateResource(int resource, const char *file, /*************************************************************************** * Remove a resource. ***************************************************************************/ -void DEBUG_ReleaseResource(int resource, const char *file, - unsigned int line) { +void +DEBUG_ReleaseResource(int resource, const char *file, + unsigned int line) +{ ResourceType *rp; |