forked from Telodendria/Telodendria
Remove non-standard __FUNCTION__ use.
This cripples the Memory API just a little bit, but I'm sure we'll still get useful enough information.
This commit is contained in:
parent
0c03c71081
commit
bb93cae99a
3 changed files with 7 additions and 21 deletions
15
src/Memory.c
15
src/Memory.c
|
@ -31,7 +31,6 @@ struct MemoryInfo
|
|||
{
|
||||
size_t size;
|
||||
const char *file;
|
||||
const char *func;
|
||||
int line;
|
||||
void *pointer;
|
||||
|
||||
|
@ -45,7 +44,7 @@ static void (*hook) (MemoryAction, MemoryInfo *, void *) = NULL;
|
|||
static void *hookArgs = NULL;
|
||||
|
||||
void *
|
||||
MemoryAllocate(size_t size, const char *file, int line, const char *func)
|
||||
MemoryAllocate(size_t size, const char *file, int line)
|
||||
{
|
||||
void *p;
|
||||
MemoryInfo *a;
|
||||
|
@ -70,7 +69,6 @@ MemoryAllocate(size_t size, const char *file, int line, const char *func)
|
|||
a->size = size;
|
||||
a->file = file;
|
||||
a->line = line;
|
||||
a->func = func;
|
||||
a->pointer = p;
|
||||
a->next = NULL;
|
||||
a->prev = lastAllocation;
|
||||
|
@ -261,17 +259,6 @@ MemoryInfoGetFile(MemoryInfo * a)
|
|||
return a->file;
|
||||
}
|
||||
|
||||
const char *
|
||||
MemoryInfoGetFunc(MemoryInfo * a)
|
||||
{
|
||||
if (!a)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return a->func;
|
||||
}
|
||||
|
||||
int
|
||||
MemoryInfoGetLine(MemoryInfo * a)
|
||||
{
|
||||
|
|
|
@ -63,9 +63,9 @@ TelodendriaMemoryHook(MemoryAction a, MemoryInfo * i, void *args)
|
|||
break;
|
||||
}
|
||||
|
||||
Log(lc, LOG_DEBUG, "%s:%d %s(): %s %lu bytes of memory at %p.",
|
||||
Log(lc, LOG_DEBUG, "%s:%d: %s %lu bytes of memory at %p.",
|
||||
MemoryInfoGetFile(i), MemoryInfoGetLine(i),
|
||||
MemoryInfoGetFunc(i), action, MemoryInfoGetSize(i),
|
||||
action, MemoryInfoGetSize(i),
|
||||
MemoryInfoGetPointer(i));
|
||||
}
|
||||
|
||||
|
@ -77,8 +77,8 @@ TelodendriaMemoryIterator(MemoryInfo * i, void *args)
|
|||
/* We haven't freed the logger memory yet */
|
||||
if (MemoryInfoGetPointer(i) != lc)
|
||||
{
|
||||
Log(lc, LOG_DEBUG, "%lu bytes of memory at %p leaked from %s() (%s:%d)",
|
||||
MemoryInfoGetSize(i), MemoryInfoGetPointer(i), MemoryInfoGetFunc(i),
|
||||
Log(lc, LOG_DEBUG, "%lu bytes of memory at %p leaked from %s:%d",
|
||||
MemoryInfoGetSize(i), MemoryInfoGetPointer(i),
|
||||
MemoryInfoGetFile(i), MemoryInfoGetLine(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,13 +33,13 @@ typedef enum MemoryAction
|
|||
MEMORY_FREE
|
||||
} MemoryAction;
|
||||
|
||||
#define Malloc(x) MemoryAllocate(x, __FILE__, __LINE__, __FUNCTION__)
|
||||
#define Malloc(x) MemoryAllocate(x, __FILE__, __LINE__)
|
||||
#define Realloc(x, s) MemoryReallocate(x, s)
|
||||
#define Free(x) MemoryFree(x)
|
||||
|
||||
typedef struct MemoryInfo MemoryInfo;
|
||||
|
||||
extern void *MemoryAllocate(size_t, const char *, int, const char *);
|
||||
extern void *MemoryAllocate(size_t, const char *, int);
|
||||
extern void *MemoryReallocate(void *, size_t);
|
||||
extern void MemoryFree(void *);
|
||||
|
||||
|
@ -50,7 +50,6 @@ extern MemoryInfo *MemoryInfoGet(void *);
|
|||
|
||||
extern size_t MemoryInfoGetSize(MemoryInfo *);
|
||||
extern const char *MemoryInfoGetFile(MemoryInfo *);
|
||||
extern const char *MemoryInfoGetFunc(MemoryInfo *);
|
||||
extern int MemoryInfoGetLine(MemoryInfo *);
|
||||
extern void *MemoryInfoGetPointer(MemoryInfo *);
|
||||
|
||||
|
|
Loading…
Reference in a new issue