Several changes for ANSI C
This commit is contained in:
parent
7d34ba62a7
commit
f8232e51a3
|
@ -10,6 +10,11 @@
|
||||||
char *Malloc(n) : allocate n bytes
|
char *Malloc(n) : allocate n bytes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
|
extern char *malloc();
|
||||||
|
#endif
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#include <system.h>
|
#include <system.h>
|
||||||
|
#include "alloc.h"
|
||||||
|
|
||||||
No_Mem()
|
No_Mem()
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,13 @@
|
||||||
char *Realloc(ptr, n) : reallocate buffer to n bytes
|
char *Realloc(ptr, n) : reallocate buffer to n bytes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
|
extern char *malloc();
|
||||||
|
extern char *realloc();
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -11,6 +11,12 @@
|
||||||
str
|
str
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
|
extern char *malloc();
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -17,11 +17,19 @@
|
||||||
char *Srealloc(str, n) same as Realloc.
|
char *Srealloc(str, n) same as Realloc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern char *Salloc(), *Malloc(), *Srealloc(), *Realloc();
|
|
||||||
#if __STDC__
|
#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
|
#else
|
||||||
extern char *malloc(), *realloc();
|
extern char *Salloc(), *Malloc(), *Srealloc(), *Realloc();
|
||||||
|
extern char *st_alloc(), *std_alloc();
|
||||||
#endif
|
#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 */
|
/* 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;
|
struct _ALLOC_ *_A_next;
|
||||||
} *_PALLOC_;
|
} *_PALLOC_;
|
||||||
|
|
||||||
extern char *st_alloc();
|
|
||||||
|
|
||||||
#define _A_st_free(ptr, phead, size) (((_PALLOC_)ptr)->_A_next = \
|
#define _A_st_free(ptr, phead, size) (((_PALLOC_)ptr)->_A_next = \
|
||||||
(_PALLOC_)(*phead), \
|
(_PALLOC_)(*phead), \
|
||||||
|
|
|
@ -7,6 +7,11 @@
|
||||||
to check if freed memory is used inappopriately.
|
to check if freed memory is used inappopriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "alloc.h"
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
void
|
||||||
|
#endif
|
||||||
botch(ptr, n)
|
botch(ptr, n)
|
||||||
register char *ptr;
|
register char *ptr;
|
||||||
register unsigned int n;
|
register unsigned int n;
|
||||||
|
|
|
@ -6,7 +6,13 @@
|
||||||
/* clear - clear a block of memory, and try to do it fast.
|
/* clear - clear a block of memory, and try to do it fast.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "alloc.h"
|
||||||
|
|
||||||
/* instead of Calloc: */
|
/* instead of Calloc: */
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
void
|
||||||
|
#endif
|
||||||
clear(ptr, n)
|
clear(ptr, n)
|
||||||
register char *ptr;
|
register char *ptr;
|
||||||
register unsigned int n;
|
register unsigned int n;
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
The counterpart, st_free, is a macro, defined in alloc.h
|
The counterpart, st_free, is a macro, defined in alloc.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
|
extern char *malloc();
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
This is a counting version of st_alloc.
|
This is a counting version of st_alloc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
|
extern char *malloc();
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
Loading…
Reference in a new issue