]> mj.ucw.cz Git - libucw.git/commitdiff
Introduced mp_alloc_zero().
authorMartin Mares <mj@ucw.cz>
Sun, 21 Jan 2001 11:07:58 +0000 (11:07 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 21 Jan 2001 11:07:58 +0000 (11:07 +0000)
lib/pool.c
lib/pools.h

index 6143c68af0b67c5f2f87301b08e90773e8b31000..4eea7bf700f8e0ab0981bd22c0f2b3933050f546 100644 (file)
@@ -8,6 +8,7 @@
 #include "lib/pools.h"
 
 #include <stdlib.h>
+#include <string.h>
 
 struct memchunk {
   struct memchunk *next;
@@ -97,3 +98,11 @@ mp_alloc(struct mempool *p, uns s)
       return c->data;
     }
 }
+
+void *
+mp_alloc_zero(struct mempool *p, uns s)
+{
+  void *x = mp_alloc(p, s);
+  bzero(x, s);
+  return x;
+}
index b8e6e9643edfece897206ee6614a89a3fea34236..3526aec0bfc9ed5627ded9464e4b33dfa2095106 100644 (file)
@@ -19,6 +19,7 @@ struct mempool *mp_new(uns);
 void mp_delete(struct mempool *);
 void mp_flush(struct mempool *);
 void *mp_alloc(struct mempool *, uns);
+void *mp_alloc_zero(struct mempool *, uns);
 
 static inline void *mp_alloc_fast(struct mempool *p, uns l)
 {