Cleanup debug code

This commit is contained in:
Carsten Larsen 2017-02-13 21:02:55 +01:00
parent 9bdcd7e438
commit 27fb80dcd9
3 changed files with 11 additions and 16 deletions

View File

@ -37,10 +37,10 @@
#define FREE_MEM(x) FreeVec(x) #define FREE_MEM(x) FreeVec(x)
#define Debug(x,y,z) #define Debug(x,y,z)
#else #else
# include <stdlib.h> #include <stdlib.h>
# define ALLOC_MEM(x) calloc(1L,x) #define ALLOC_MEM(x) calloc(1L,x)
# define FREE_MEM(x) free(x) #define FREE_MEM(x) free(x)
# define Debug(x,y,z) #define Debug(x,y,z)
#endif #endif
#if defined(__x86_64__) || defined(__aarch64__) || \ #if defined(__x86_64__) || defined(__aarch64__) || \
@ -130,9 +130,7 @@ void* AllocMemSafe(size_t size)
list->peak = list->size; list->peak = list->size;
} }
// DEBUG code // Memory allocated
// Debug(NULL, "Mememory allocated at address (%x)\n", newblock->address);
return newblock->address; return newblock->address;
} }
@ -179,9 +177,6 @@ void FreeMemSafe(void* block)
current->next = NULL; current->next = NULL;
current->size = 0; current->size = 0;
FREE_MEM(current); FREE_MEM(current);
// DEBUG code
// Debug("Mememory deallocated at address (%x)\n", block);
} }
/** /**
@ -218,17 +213,17 @@ void MemUsage(long *blocks, long *size, long *peak)
} }
/** /**
* @brief Log a mememory allocation error * @brief Log a memory allocation error
*/ */
void alloc_error(char *descr, size_t size) void alloc_error(char *descr, size_t size)
{ {
Debug("Mememory allocation error (%s) with size (%d)\n", descr, size); Debug("Memory allocation error (%s) with size (%d)\n", descr, size);
} }
/** /**
* @brief Log a mememory deallocation error * @brief Log a memory deallocation error
*/ */
void dealloc_error(char *descr, void *p) void dealloc_error(char *descr, void *p)
{ {
Debug("Mememory deallocation error (%s) address (%x)\n", descr, p); Debug("Memory deallocation error (%s) address (%x)\n", descr, p);
} }

View File

@ -31,7 +31,7 @@
*/ */
/** /**
* @file memcpy.h * @file memcpy.c
* @brief Copy a block of memory, handling overlap. * @brief Copy a block of memory, handling overlap.
* *
* Code originate from FreeBSD base, revision 229286. * Code originate from FreeBSD base, revision 229286.

View File

@ -31,7 +31,7 @@
*/ */
/** /**
* @file memset.h * @file memset.c
* @brief Fill block of memory with a constant value. * @brief Fill block of memory with a constant value.
* *
* Code originate from FreeBSD base, revision 229286. * Code originate from FreeBSD base, revision 229286.