found a bug, wasn't returning pointer at end of poolcreate--pool allocation doesn...
[IRC.git] / Robust / src / Runtime / memPool.h
index 356e15e8f3cb1cb9380798a0c3ecc9057d1349d3..b9b55cf659c3dae3cdc58edb2b08508ec2ae0a3c 100644 (file)
 //////////////////////////////////////////////////////////
 
 #include <stdlib.h>
-
-// just until uninitialized mem bug found
-#include <string.h>
-
 #include "mlp_lock.h"
 
 
@@ -56,6 +52,7 @@ static MemPool* poolcreate( int itemSize ) {
   p->head       = calloc( 1, itemSize );
   p->head->next = NULL;
   p->tail       = p->head;
+  return p;
 }
 
 
@@ -113,16 +110,13 @@ static inline void* poolalloc( MemPool* p ) {
 
   if( headCurrent->next == NULL ) {
     // only one item, so don't take from pool
-    //return malloc( p->itemSize );
-
-    // just until uninitialized mem bug found
-    return calloc( 1, p->itemSize );
+    return malloc( p->itemSize );
   }
  
   p->head = headCurrent->next;
 
   // just until uninitialized mem bug found
-  memset( headCurrent, 0, p->itemSize );
+  //memset( headCurrent, 0, p->itemSize );
 
   return headCurrent;
 }