-
-#include <stdlib.h>
-
-#define ALLOCUNIT 100
-
-static void *malloclist;
-static chanstats *freecs;
-
-void *cstsmalloc(size_t size) {
- void **mem;
-
- /* Get the memory we want, with an extra four bytes for our pointer */
- mem=(void **)malloc(size+sizeof(void *));
-
- /* Set the first word to point at the last chunk we got */
- *mem=malloclist;
-
- /* Now set the "last chunk" pointer to the address of this one */
- malloclist=(void *)mem;
-
- /* Return the rest of the memory to the caller */
- return (void *)(mem+1);
-}