1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-17 00:05:23 +00:00

Clean compile with RAMSIZE and RAMSHOW activated.

This commit is contained in:
Renaud 2013-10-11 15:36:36 +08:00
parent da813d2efc
commit 81c98138de
2 changed files with 16 additions and 6 deletions

View File

@ -87,7 +87,9 @@
/* Debugging options */ /* Debugging options */
#define RAMSIZE 0 /* dynamic RAM memory usage tracking */ #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 #ifndef AUTOCONF
@ -270,6 +272,9 @@
/* Dynamic RAM tracking and reporting redefinitions */ /* Dynamic RAM tracking and reporting redefinitions */
#if RAMSIZE #if RAMSIZE
#include <stdlib.h>
void *allocate( size_t size) ;
void release( void *ptr) ;
#define malloc allocate #define malloc allocate
#define free release #define free release
#endif #endif

15
main.c
View File

@ -510,16 +510,19 @@ static void edinit(char *bname)
end of the bottom mode line and is updated whenever it is changed. end of the bottom mode line and is updated whenever it is changed.
*/ */
static void dspram( void) ;
#undef malloc #undef malloc
#undef free #undef free
#if 0
char *allocate(nbytes) char *allocate(nbytes)
/* allocate nbytes and track */ /* allocate nbytes and track */
unsigned nbytes; /* # of bytes to allocate */ unsigned nbytes; /* # of bytes to allocate */
#endif
void *allocate( size_t nbytes)
{ {
char *mp; /* ptr returned from malloc */ char *mp; /* ptr returned from malloc */
char *malloc(); /* char *malloc(); */
mp = malloc(nbytes); mp = malloc(nbytes);
if (mp) { if (mp) {
@ -532,10 +535,12 @@ unsigned nbytes; /* # of bytes to allocate */
return mp; return mp;
} }
#if 0
release(mp) release(mp)
/* release malloced memory and track */ /* release malloced memory and track */
char *mp; /* chunk of RAM to release */ char *mp; /* chunk of RAM to release */
#endif
void release( void *mp)
{ {
unsigned *lp; /* ptr to the long containing the block size */ unsigned *lp; /* ptr to the long containing the block size */
@ -551,7 +556,7 @@ char *mp; /* chunk of RAM to release */
} }
#if RAMSHOW #if RAMSHOW
dspram() static void dspram( void)
{ /* display the amount of RAM currently malloced */ { /* display the amount of RAM currently malloced */
char mbuf[20]; char mbuf[20];
char *sp; char *sp;