botch.c\
clear.c\
st_alloc.c\
- std_alloc.c
+ std_alloc.c \
+ No_Mem.c
-OBJECTS = botch.o clear.o st_alloc.o Malloc.o std_alloc.o
+OBJECTS = botch.o clear.o st_alloc.o Malloc.o std_alloc.o No_Mem.o
all: liballoc.a
#include "in_all.h"
#include "alloc.h"
-PRIVATE
-m_fatal() {
-
- (void) sys_write(2, "Out of memory\n", 14);
- sys_stop(S_EXIT);
-}
-
EXPORT char *
Malloc(sz)
unsigned int sz;
{
char *res = malloc(sz);
- if (res == 0) m_fatal();
+ if (res == 0) No_Mem();
return res;
}
char *res = malloc(sz);
register char *m = res;
- if (m == 0) m_fatal();
+ if (m == 0) No_Mem();
while (sz--)
*m++ = *str++;
return res;
unsigned int sz;
{
str = realloc(str, sz);
- if (str == 0) m_fatal();
+ if (str == 0) No_Mem();
return str;
}
malloc(3)
.SH DIAGNOSTICS
\fIMalloc\fR, \fISalloc\fR, \fISrealloc\fR, and \fIst_alloc\fR
-give an error message and stop execution if there is no memory available.
+call a routine \fINo_Mem\fR if there is no memory available. This routine
+is not supposed to return. A default one, that
+gives an error message and stops execution, is provided.