-void *mallocs=NULL;
-
-void *smalloc(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=mallocs;
-
- /* Now set the "last chunk" pointer to the address of this one */
- mallocs=(void *)mem;
-
- /* Return the rest of the memory to the caller */
- return (void *)(mem+1);
-}
-
-void sfreeall() {
- void *vp,**vp2;
-
- vp=mallocs;
-
- while (vp!=NULL) {
- vp2=(void **)vp;
- vp=*vp2;
- free((void *)vp2);
- }
-}
-