aboutsummaryrefslogtreecommitdiff
path: root/src/memdebug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/memdebug.h')
-rw-r--r--src/memdebug.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/memdebug.h b/src/memdebug.h
index 7d72a10..c318656 100644
--- a/src/memdebug.h
+++ b/src/memdebug.h
@@ -22,6 +22,8 @@ void *__memdebug_calloc(size_t nmemb, size_t size, char *file, int line);
void *__memdebug_realloc(void *ptr, size_t size, char *file, int line);
void __memdebug_free(void *ptr, char *file, int line);
+int memdebug_log(char *format, ...);
+
#ifdef MEMDEBUG_IMPLEMENTATION
// Default memory allocation functions
@@ -66,6 +68,7 @@ typedef long long int memdebug_suffix;
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
+#include <stdarg.h>
#include <errno.h>
#include <time.h>
@@ -95,6 +98,18 @@ static inline void *memdebug_add_out_of_bounds_check(void *addr, size_t size)
return (void *)((uintptr_t)addr + sizeof(size));
}
+int memdebug_log(char *format, ...)
+{
+ int ret = 0;
+ va_list args;
+
+ va_start(args, format);
+ ret = vfprintf(_memdebug_fp, format, args);
+ va_end(args);
+
+ return ret;
+}
+
void *__memdebug_malloc(size_t size, char *file, int line)
{
#ifndef MEMDEBUG_OUT_OF_BOUNDS