* Sebastian Hammer, Adam Dickmeiss
*
* $Log: nmem.c,v $
- * Revision 1.1 1995-11-13 09:27:52 quinn
+ * Revision 1.2 1995-12-13 13:44:37 quinn
+ * Modified Data1-system to use nmem
+ *
+ * Revision 1.1 1995/11/13 09:27:52 quinn
* Fiddling with the variant stuff.
*
*
{
int total;
nmem_block *blocks;
+ struct nmem_control *next;
} nmem_control;
-static nmem_block *freelist = 0; /* global freelist */
+static nmem_block *freelist = 0; /* global freelists */
+static nmem_control *cfreelist = 0;
static void free_block(nmem_block *p)
{
NMEM nmem_create(void)
{
- NMEM r = xmalloc(sizeof(*r));
+ NMEM r = cfreelist;
+ if (r)
+ cfreelist = cfreelist->next;
+ else
+ r = xmalloc(sizeof(*r));
r->blocks = 0;
r->total = 0;
+ r->next = 0;
return r;
}
if (!n)
return;
nmem_reset(n);
- xfree(n);
+ n->next = cfreelist;
+ cfreelist = n;
}