home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * FREE.C
- *
- * (c)Copyright 1990, Matthew Dillon, All Rights Reserved
- */
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <stdlib.h>
-
- extern long *__MemList;
-
- void
- free(ptr)
- void *ptr;
- {
- long **scan = &__MemList;
- long *item;
-
- if (ptr == NULL)
- Wait(0);
-
- ptr = (void *)((long *)ptr - 2);
-
- while (item = *scan) {
- if (item == (long *)ptr) {
- *scan = *(long **)item;
- FreeMem(ptr, ((long *)ptr)[1]);
- return;
- }
- scan = (long **)item;
- }
- Wait(0);
- }
-
-