home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * MALLOC.C
- *
- * (c)Copyright 1990, Matthew Dillon, All Rights Reserved
- */
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <stdlib.h>
- #include <errno.h>
-
- extern long *__MemList;
-
- extern void *AllocMem();
-
- void *
- malloc(bytes)
- size_t bytes;
- {
- long *ptr;
-
- if (bytes == 0)
- return(NULL);
-
- ptr = AllocMem(bytes + 8, MEMF_PUBLIC);
- if (ptr) {
- ptr[0] = (long *)__MemList;
- __MemList = ptr;
- ptr[1] = bytes + 8;
- ptr += 2;
- } else {
- errno = ENOMEM;
- }
- return((void *)ptr);
- }
-
-