mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
--enable-amalloc) replaced malloc and its ilk with
versions that attempt to maintain a linked list of
allocated blocks that can be printed to stderr with
the `adump()` function.
2. Clean up a couple more places where I leak memory
during the first level parse.
3. tweak cstring.h to try to chase down places where
the C compiler might optimize EXPAND() into producing
broken code.
30 lines
492 B
C
30 lines
492 B
C
/*
|
|
* debugging malloc()/realloc()/calloc()/free() that attempts
|
|
* to keep track of just what's been allocated today.
|
|
*/
|
|
#ifndef AMALLOC_D
|
|
#define AMALLOC_D
|
|
|
|
#include "config.h"
|
|
|
|
#ifdef USE_AMALLOC
|
|
|
|
extern void *amalloc(int);
|
|
extern void *acalloc(int,int);
|
|
extern void *arealloc(void*,int);
|
|
extern void afree(void*);
|
|
extern void adump();
|
|
|
|
#define malloc amalloc
|
|
#define calloc acalloc
|
|
#define realloc arealloc
|
|
#define free afree
|
|
|
|
#else
|
|
|
|
#define adump() (void)1
|
|
|
|
#endif
|
|
|
|
#endif/*AMALLOC_D*/
|