Fix bug with logger, add memory allocation logging
This commit is contained in:
@@ -108,8 +108,9 @@ void bzLoggerLogV(BzLoggerLevel level, const char *file, int line, const char *f
|
||||
|
||||
for (int i = 0; i < BZ_LOGGER_MAX_CALLBACKS; ++i) {
|
||||
BzLoggerCallback cb = BZ_GET_LOGGER_MODULE()->callbacks[i];
|
||||
if (!cb.callback) break;
|
||||
|
||||
if (level <= cb.level) {
|
||||
if (level >= cb.level) {
|
||||
event.userData = cb.userData;
|
||||
|
||||
va_copy(event.va, va);
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
#include "memory.h"
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
|
||||
void *bzAlloc(size_t numBytes) {
|
||||
return malloc(numBytes);
|
||||
void *ptr = malloc(numBytes);
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Allocating address: %p (num bytes: %llu)", ptr, numBytes);
|
||||
return ptr;
|
||||
}
|
||||
void bzFree(void *ptr) {
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Freeing address: %p", ptr);
|
||||
free(ptr);
|
||||
}
|
||||
void *bzCalloc(size_t numBytes, size_t count) {
|
||||
return calloc(numBytes, count);
|
||||
void *ptr = calloc(numBytes, count);
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Allocating address: %p (num bytes: %llu)", ptr, numBytes * count);
|
||||
return ptr;
|
||||
}
|
||||
void *bzResize(void *ptr, size_t newSize) {
|
||||
return realloc(ptr, newSize);
|
||||
void *outPtr = realloc(ptr, newSize);
|
||||
bzLoggerOnlyLog(BZ_LOG_TRACE, "Resizing address: %p (%p) to %llu bytes.", outPtr, ptr, newSize);
|
||||
return outPtr;
|
||||
}
|
||||
|
||||
void *bzMemSet(void *ptr, int value, size_t numBytes) {
|
||||
|
||||
Reference in New Issue
Block a user