From 3577eb6f136bf2b394c2ce839fc098da5faa9fd5 Mon Sep 17 00:00:00 2001 From: Waldemar Celes Date: Mon, 28 Mar 1994 12:14:02 -0300 Subject: [PATCH] Acrescentar o include do gerenciador de memoria "mm". --- hash.c | 4 +++- iolib.c | 4 +++- mm.h | 39 +++++++++++++++++++++++++++++++++++++++ opcode.c | 4 +++- strlib.c | 4 +++- 5 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 mm.h diff --git a/hash.c b/hash.c index fa1f3b8b..1704acfe 100644 --- a/hash.c +++ b/hash.c @@ -4,11 +4,13 @@ ** Luiz Henrique de Figueiredo - 17 Aug 90 */ -char *rcs_hash="$Id: $"; +char *rcs_hash="$Id: hash.c,v 1.1 1993/12/17 18:41:19 celes Exp celes $"; #include #include +#include "mm.h" + #include "opcode.h" #include "hash.h" #include "inout.h" diff --git a/iolib.c b/iolib.c index 4a885f97..f866fb3d 100644 --- a/iolib.c +++ b/iolib.c @@ -3,7 +3,7 @@ ** Input/output library to LUA */ -char *rcs_iolib="$Id: iolib.c,v 1.1 1993/12/17 18:41:19 celes Exp roberto $"; +char *rcs_iolib="$Id: iolib.c,v 1.2 1993/12/30 14:52:18 roberto Exp celes $"; #include #include @@ -14,6 +14,8 @@ char *rcs_iolib="$Id: iolib.c,v 1.1 1993/12/17 18:41:19 celes Exp roberto $"; #include #endif +#include "mm.h" + #include "lua.h" static FILE *in=stdin, *out=stdout; diff --git a/mm.h b/mm.h new file mode 100644 index 00000000..40fdf84d --- /dev/null +++ b/mm.h @@ -0,0 +1,39 @@ +/* +** mm.h +** Waldemar Celes Filho +** Sep 16, 1992 +*/ + + +#ifndef mm_h +#define mm_h + +#include + +#ifdef _MM_ + +/* switch off the debugger functions */ +#define malloc(s) MmMalloc(s,__FILE__,__LINE__) +#define calloc(n,s) MmCalloc(n,s,__FILE__,__LINE__) +#define realloc(a,s) MmRealloc(a,s,__FILE__,__LINE__,#a) +#define free(a) MmFree(a,__FILE__,__LINE__,#a) +#define strdup(s) MmStrdup(s,__FILE__,__LINE__) +#endif + +typedef void (*Ferror) (char *); + +/* Exported functions */ +void MmInit (Ferror f, Ferror w); +void *MmMalloc (unsigned size, char *file, int line); +void *MmCalloc (unsigned n, unsigned size, char *file, int line); +void MmFree (void *a, char *file, int line, char *var); +void *MmRealloc (void *old, unsigned size, char *file, int line, char *var); +char *MmStrdup (char *s, char *file, int line); +unsigned MmGetBytes (void); +void MmListAllocated (void); +void MmCheck (void); +void MmStatistics (void); + + +#endif + diff --git a/opcode.c b/opcode.c index 3ba6f2d2..5fc75b5c 100644 --- a/opcode.c +++ b/opcode.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 1.1 1993/12/17 18:41:19 celes Exp roberto $"; +char *rcs_opcode="$Id: opcode.c,v 1.2 1994/02/13 20:36:51 roberto Exp celes $"; #include #include @@ -12,6 +12,8 @@ char *rcs_opcode="$Id: opcode.c,v 1.1 1993/12/17 18:41:19 celes Exp roberto $"; #include #endif +#include "mm.h" + #include "opcode.h" #include "hash.h" #include "inout.h" diff --git a/strlib.c b/strlib.c index 87622e9c..e2e2666c 100644 --- a/strlib.c +++ b/strlib.c @@ -3,12 +3,14 @@ ** String library to LUA */ -char *rcs_strlib="$Id: $"; +char *rcs_strlib="$Id: strlib.c,v 1.1 1993/12/17 18:41:19 celes Exp celes $"; #include #include #include +#include "mm.h" + #include "lua.h"