From f8232e51a38a40eedc033d7540fdf536a67d4bf0 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 4 Dec 1992 09:36:54 +0000 Subject: [PATCH] Several changes for ANSI C --- modules/src/alloc/Malloc.c | 5 +++++ modules/src/alloc/No_Mem.c | 1 + modules/src/alloc/Realloc.c | 7 +++++++ modules/src/alloc/Salloc.c | 6 ++++++ modules/src/alloc/alloc.h | 15 +++++++++++---- modules/src/alloc/botch.c | 5 +++++ modules/src/alloc/clear.c | 6 ++++++ modules/src/alloc/st_alloc.c | 6 ++++++ modules/src/alloc/std_alloc.c | 6 ++++++ 9 files changed, 53 insertions(+), 4 deletions(-) diff --git a/modules/src/alloc/Malloc.c b/modules/src/alloc/Malloc.c index 29951d013..156f117fa 100644 --- a/modules/src/alloc/Malloc.c +++ b/modules/src/alloc/Malloc.c @@ -10,6 +10,11 @@ char *Malloc(n) : allocate n bytes */ +#if __STDC__ +#include +#else +extern char *malloc(); +#endif #include "alloc.h" char * diff --git a/modules/src/alloc/No_Mem.c b/modules/src/alloc/No_Mem.c index 3a0155b59..c880881df 100644 --- a/modules/src/alloc/No_Mem.c +++ b/modules/src/alloc/No_Mem.c @@ -4,6 +4,7 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include +#include "alloc.h" No_Mem() { diff --git a/modules/src/alloc/Realloc.c b/modules/src/alloc/Realloc.c index 76e24d9e7..e40af1b11 100644 --- a/modules/src/alloc/Realloc.c +++ b/modules/src/alloc/Realloc.c @@ -10,6 +10,13 @@ char *Realloc(ptr, n) : reallocate buffer to n bytes */ +#if __STDC__ +#include +#else +extern char *malloc(); +extern char *realloc(); +#endif + #include "alloc.h" char * diff --git a/modules/src/alloc/Salloc.c b/modules/src/alloc/Salloc.c index 4d16045c2..ba7f074d9 100644 --- a/modules/src/alloc/Salloc.c +++ b/modules/src/alloc/Salloc.c @@ -11,6 +11,12 @@ str */ +#if __STDC__ +#include +#else +extern char *malloc(); +#endif + #include "alloc.h" char * diff --git a/modules/src/alloc/alloc.h b/modules/src/alloc/alloc.h index 966aaf8ce..82783a2d9 100644 --- a/modules/src/alloc/alloc.h +++ b/modules/src/alloc/alloc.h @@ -17,11 +17,19 @@ char *Srealloc(str, n) same as Realloc. */ -extern char *Salloc(), *Malloc(), *Srealloc(), *Realloc(); #if __STDC__ -extern void *malloc(), *realloc(); +char *Malloc(unsigned int); +char *Salloc(char *, unsigned int); +char *Srealloc(char *, unsigned int); +char *Realloc(char *, unsigned int); +char *st_alloc(char **, unsigned int, int); +char *std_alloc(char **, unsigned int, int, int *); +int No_Mem(void); +void clear(char *, unsigned int); +void botch(char *, unsigned int); #else -extern char *malloc(), *realloc(); +extern char *Salloc(), *Malloc(), *Srealloc(), *Realloc(); +extern char *st_alloc(), *std_alloc(); #endif /* S T R U C T U R E - S T O R A G E D E F I N I T I O N S */ @@ -30,7 +38,6 @@ typedef struct _ALLOC_ { struct _ALLOC_ *_A_next; } *_PALLOC_; -extern char *st_alloc(); #define _A_st_free(ptr, phead, size) (((_PALLOC_)ptr)->_A_next = \ (_PALLOC_)(*phead), \ diff --git a/modules/src/alloc/botch.c b/modules/src/alloc/botch.c index 410da9358..cc5880866 100644 --- a/modules/src/alloc/botch.c +++ b/modules/src/alloc/botch.c @@ -7,6 +7,11 @@ to check if freed memory is used inappopriately. */ +#include "alloc.h" + +#if __STDC__ +void +#endif botch(ptr, n) register char *ptr; register unsigned int n; diff --git a/modules/src/alloc/clear.c b/modules/src/alloc/clear.c index 996af5343..36ebcad59 100644 --- a/modules/src/alloc/clear.c +++ b/modules/src/alloc/clear.c @@ -6,7 +6,13 @@ /* clear - clear a block of memory, and try to do it fast. */ +#include "alloc.h" + /* instead of Calloc: */ + +#if __STDC__ +void +#endif clear(ptr, n) register char *ptr; register unsigned int n; diff --git a/modules/src/alloc/st_alloc.c b/modules/src/alloc/st_alloc.c index ad469dff8..404d95c33 100644 --- a/modules/src/alloc/st_alloc.c +++ b/modules/src/alloc/st_alloc.c @@ -8,6 +8,12 @@ The counterpart, st_free, is a macro, defined in alloc.h */ +#if __STDC__ +#include +#else +extern char *malloc(); +#endif + #include "alloc.h" char * diff --git a/modules/src/alloc/std_alloc.c b/modules/src/alloc/std_alloc.c index ada36f2cb..5335cf0ee 100644 --- a/modules/src/alloc/std_alloc.c +++ b/modules/src/alloc/std_alloc.c @@ -9,6 +9,12 @@ This is a counting version of st_alloc. */ +#if __STDC__ +#include +#else +extern char *malloc(); +#endif + #include "alloc.h" char * -- 2.34.1