diff --git a/estruct.h b/estruct.h index 6133e28..22acf9d 100644 --- a/estruct.h +++ b/estruct.h @@ -87,7 +87,9 @@ /* Debugging options */ #define RAMSIZE 0 /* dynamic RAM memory usage tracking */ -#define RAMSHOW 0 /* auto dynamic RAM reporting */ +#if RAMSIZE +#define RAMSHOW 1 /* auto dynamic RAM reporting */ +#endif #ifndef AUTOCONF @@ -270,6 +272,9 @@ /* Dynamic RAM tracking and reporting redefinitions */ #if RAMSIZE +#include +void *allocate( size_t size) ; +void release( void *ptr) ; #define malloc allocate #define free release #endif diff --git a/main.c b/main.c index c2f8ff5..5f23a86 100644 --- a/main.c +++ b/main.c @@ -510,16 +510,19 @@ static void edinit(char *bname) end of the bottom mode line and is updated whenever it is changed. */ +static void dspram( void) ; + #undef malloc #undef free - +#if 0 char *allocate(nbytes) /* allocate nbytes and track */ unsigned nbytes; /* # of bytes to allocate */ - +#endif +void *allocate( size_t nbytes) { char *mp; /* ptr returned from malloc */ - char *malloc(); +/* char *malloc(); */ mp = malloc(nbytes); if (mp) { @@ -532,10 +535,12 @@ unsigned nbytes; /* # of bytes to allocate */ return mp; } +#if 0 release(mp) /* release malloced memory and track */ char *mp; /* chunk of RAM to release */ - +#endif +void release( void *mp) { unsigned *lp; /* ptr to the long containing the block size */ @@ -551,7 +556,7 @@ char *mp; /* chunk of RAM to release */ } #if RAMSHOW -dspram() +static void dspram( void) { /* display the amount of RAM currently malloced */ char mbuf[20]; char *sp;