/*
* Sherlock Library -- Memory Pools (One-Time Allocation)
*
- * (c) 1997--1999 Martin Mares <mj@ucw.cz>
+ * (c) 1997--2001 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
*/
#include "lib/lib.h"
#include "lib/pools.h"
#include <stdlib.h>
+#include <string.h>
struct memchunk {
struct memchunk *next;
};
struct mempool *
-new_pool(uns size)
+mp_new(uns size)
{
struct mempool *p = xmalloc(sizeof(struct mempool));
}
void
-free_pool(struct mempool *p)
+mp_delete(struct mempool *p)
{
struct memchunk *c, *d;
}
void
-flush_pool(struct mempool *p)
+mp_flush(struct mempool *p)
{
struct memchunk *c;
}
void *
-pool_alloc(struct mempool *p, uns s)
+mp_alloc(struct mempool *p, uns s)
{
if (s <= p->threshold)
{
return c->data;
}
}
+
+void *
+mp_alloc_zero(struct mempool *p, uns s)
+{
+ void *x = mp_alloc(p, s);
+ bzero(x, s);
+ return x;
+}