File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,19 @@ void* Pool_allocate(Pool* this) {
6868 }
6969}
7070
71+ inline void * Pool_allocateClear (Pool * this ) {
72+ return memset (Pool_allocate (this ), 0 , this -> objectSize );
73+ }
74+
7175void Pool_free (Pool * this , void * item ) {
7276 if (this -> destroying )
7377 return ;
74- if (this -> freeListUsed < this -> freeListSize ) {
75- this -> freeList [this -> freeListSize ++ ] = item ;
76- } else {
78+ assert (!(this -> freeListUsed > this -> freeListSize ));
79+ if (this -> freeListUsed == this -> freeListSize ) {
7780 this -> freeListSize += POOL_FREELIST_RATE ;
7881 this -> freeList = realloc (this -> freeList , sizeof (void * ) * this -> freeListSize );
79- this -> freeList [this -> freeListSize ++ ] = item ;
8082 }
83+ this -> freeList [this -> freeListUsed ++ ] = item ;
8184}
8285
8386void Pool_delete (Pool * this ) {
You can’t perform that action at this time.
0 commit comments