From 4639aa999e0776b02651412ab12ded8f0c35669c Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 21 Nov 2000 04:01:10 +0000 Subject: New function to allocate a zero'd out chunk. 2000-11-21 Not Zed * e-memory.c (e_memchunk_alloc0): New function to allocate a zero'd out chunk. svn path=/trunk/; revision=6624 --- e-util/ChangeLog | 5 +++++ e-util/e-memory.c | 10 ++++++++++ e-util/e-memory.h | 1 + 3 files changed, 16 insertions(+) diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 65cd11ae63..2fbb4631a2 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,8 @@ +2000-11-21 Not Zed + + * e-memory.c (e_memchunk_alloc0): New function to allocate a + zero'd out chunk. + 2000-11-20 Not Zed * e-memory.[ch]: New routines for fast memory management and diff --git a/e-util/e-memory.c b/e-util/e-memory.c index c3f7bfde15..2a3cd55771 100644 --- a/e-util/e-memory.c +++ b/e-util/e-memory.c @@ -135,6 +135,16 @@ void *e_memchunk_alloc(MemChunk *m) } } +void *e_memchunk_alloc0(EMemChunk *m) +{ + void *mem; + + mem = e_memchunk_alloc(m); + memset(mem, 0, m->atomsize); + + return mem; +} + /** * e_memchunk_free: * @m: diff --git a/e-util/e-memory.h b/e-util/e-memory.h index d0c2a0ee3c..3f1f2f0f4d 100644 --- a/e-util/e-memory.h +++ b/e-util/e-memory.h @@ -28,6 +28,7 @@ typedef struct _EMemChunk EMemChunk; EMemChunk *e_memchunk_new(int atomcount, int atomsize); void *e_memchunk_alloc(EMemChunk *m); +void *e_memchunk_alloc0(EMemChunk *m); void e_memchunk_free(EMemChunk *m, void *mem); void e_memchunk_empty(EMemChunk *m); void e_memchunk_clean(EMemChunk *m); -- cgit