Skip to content
Snippets Groups Projects
Commit abfc6c2d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

dmemory.h update.

parent 7c768ee2
No related branches found
No related tags found
1 merge request!58M214003/develop
......@@ -12,7 +12,7 @@
#define WITH_FUNCTION_NAME
#endif
#ifdef __cplusplus
#ifdef __cplusplus
extern "C" {
#endif
......@@ -20,29 +20,38 @@ extern size_t memTotal(void);
extern void memDebug(int debug);
extern void memExitOnError(void);
#if defined DEBUG_MEMORY
extern void *memRealloc(void *ptr, size_t size, const char *file, const char *functionname, int line);
extern void *memCalloc (size_t nobjs, size_t size, const char *file, const char *functionname, int line);
extern void *memMalloc (size_t size, const char *file, const char *functionname, int line);
extern void memFree (void *ptr, const char *file, const char *functionname, int line);
extern void *memCalloc(size_t nobjs, size_t size, const char *file, const char *functionname, int line);
extern void *memMalloc(size_t size, const char *file, const char *functionname, int line);
extern void memFree(void *ptr, const char *file, const char *functionname, int line);
#ifdef __cplusplus
}
#endif
#ifdef DEBUG_MEMORY
#ifdef WITH_FUNCTION_NAME
# define Realloc(p, s) memRealloc((p), (s), __FILE__, __func__, __LINE__)
# define Calloc(n, s) memCalloc((n), (s), __FILE__, __func__, __LINE__)
# define Malloc(s) memMalloc((s), __FILE__, __func__, __LINE__)
# define Free(p) memFree((p), __FILE__, __func__, __LINE__)
#define Realloc(p, s) memRealloc((p), (s), __FILE__, __func__, __LINE__)
#define Calloc(n, s) memCalloc((n), (s), __FILE__, __func__, __LINE__)
#define Malloc(s) memMalloc((s), __FILE__, __func__, __LINE__)
#define Free(p) memFree((p), __FILE__, __func__, __LINE__)
#else
# define Realloc(p, s) memRealloc((p), (s), __FILE__, (void *) NULL, __LINE__)
# define Calloc(n, s) memCalloc((n), (s), __FILE__, (void *) NULL, __LINE__)
# define Malloc(s) memMalloc((s), __FILE__, (void *) NULL, __LINE__)
# define Free(p) memFree((p), __FILE__, (void *) NULL, __LINE__)
#define Realloc(p, s) memRealloc((p), (s), __FILE__, (void *) NULL, __LINE__)
#define Calloc(n, s) memCalloc((n), (s), __FILE__, (void *) NULL, __LINE__)
#define Malloc(s) memMalloc((s), __FILE__, (void *) NULL, __LINE__)
#define Free(p) memFree((p), __FILE__, (void *) NULL, __LINE__)
#endif
#else
#include <stdlib.h>
#define Realloc(p, s) realloc((p), (s))
#define Calloc(n, s) calloc((n), (s))
#define Malloc(s) malloc((s))
#define Free(p) free((p))
#endif /* DEBUG_MEMORY */
// clang-format on
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment