[llvm-commits] [poolalloc] r117012 - in /poolalloc/trunk/runtime/FL2Allocator: PoolAllocator.cpp PoolAllocator.h

John Criswell criswell at uiuc.edu
Thu Oct 21 07:51:52 PDT 2010


Author: criswell
Date: Thu Oct 21 09:51:52 2010
New Revision: 117012

URL: http://llvm.org/viewvc/llvm-project?rev=117012&view=rev
Log:
Added the poolcalloc() function.

Modified:
    poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.cpp
    poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.h

Modified: poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.cpp?rev=117012&r1=117011&r2=117012&view=diff
==============================================================================
--- poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.cpp (original)
+++ poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.cpp Thu Oct 21 09:51:52 2010
@@ -883,6 +883,16 @@
   return to_return;
 }
 
+void *poolcalloc(PoolTy<NormalPoolTraits> *Pool,
+                 unsigned NumBytes,
+                 unsigned NumElements) {
+  void * p = poolalloc (Pool, NumBytes * NumElements);
+  if (p) {
+    memset (p, 0, NumBytes * NumElements);
+  }
+  return p;
+}
+
 void *poolmemalign(PoolTy<NormalPoolTraits> *Pool,
                    unsigned Alignment, unsigned NumBytes) {
   //punt and use pool alloc.

Modified: poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.h?rev=117012&r1=117011&r2=117012&view=diff
==============================================================================
--- poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.h (original)
+++ poolalloc/trunk/runtime/FL2Allocator/PoolAllocator.h Thu Oct 21 09:51:52 2010
@@ -189,6 +189,7 @@
   void poolmakeunfreeable(PoolTy<NormalPoolTraits> *Pool);
   void pooldestroy(PoolTy<NormalPoolTraits> *Pool);
   void *poolalloc(PoolTy<NormalPoolTraits> *Pool, unsigned NumBytes);
+  void *poolcalloc(PoolTy<NormalPoolTraits> *Pool, unsigned NumBytes, unsigned);
   void *poolrealloc(PoolTy<NormalPoolTraits> *Pool,
                     void *Node, unsigned NumBytes);
   void *poolmemalign(PoolTy<NormalPoolTraits> *Pool,





More information about the llvm-commits mailing list