return e;
}
-static void AlpResultElmtPoolFree(void *e)
+static void AlpResultElmtPoolCleanup(void *e)
{
AppLayerParserResultElmt *re = (AppLayerParserResultElmt *)e;
* \todo Per thread pool */
al_result_pool = PoolInit(1000, 250,
sizeof(AppLayerParserResultElmt),
- AlpResultElmtPoolAlloc, NULL, NULL, AlpResultElmtPoolFree);
+ AlpResultElmtPoolAlloc, NULL, NULL, AlpResultElmtPoolCleanup);
RegisterHTPParsers();
RegisterSSLParsers();
* the pool.
*/
static void
-DefragTrackerFree(void *arg)
+DefragTrackerCleanup(void *arg)
{
DefragTracker *tracker = arg;
}
dc->tracker_pool = PoolInit(tracker_pool_size, tracker_pool_size,
sizeof(DefragTracker),
- NULL, DefragTrackerInit, dc, DefragTrackerFree);
+ NULL, DefragTrackerInit, dc, DefragTrackerCleanup);
if (dc->tracker_pool == NULL) {
SCLogError(SC_ERR_MEM_ALLOC,
"Defrag: Failed to initialize tracker pool.");
return 1;
}
-/** \brief free a tcp segment pool entry */
-void TcpSegmentPoolFree(void *ptr) {
+/** \brief clean up a tcp segment pool entry */
+void TcpSegmentPoolCleanup(void *ptr) {
if (ptr == NULL)
return;
sizeof (TcpSegment),
TcpSegmentPoolAlloc, TcpSegmentPoolInit,
(void *) &segment_pool_pktsizes[u16],
- TcpSegmentPoolFree);
+ TcpSegmentPoolCleanup);
SCMutexUnlock(&segment_pool_mutex[u16]);
}
/** \brief Pool free function
* \param s Void ptr to TcpSession memory */
-void StreamTcpSessionPoolFree(void *s)
+void StreamTcpSessionPoolCleanup(void *s)
{
StreamMsg *smsg = NULL;
sizeof(TcpSession),
StreamTcpSessionPoolAlloc,
StreamTcpSessionPoolInit, NULL,
- StreamTcpSessionPoolFree);
+ StreamTcpSessionPoolCleanup);
if (ssn_pool == NULL) {
SCLogError(SC_ERR_POOL_INIT, "ssn_pool is not initialized");
SCMutexUnlock(&ssn_pool_mutex);
/** \brief Init a Pool
*
* PoolInit() creates a ::Pool. The Alloc function must only do
- * allocation stuff. The Free function must not try to free
+ * allocation stuff. The Cleanup function must not try to free
* the PoolBucket::data. This is done by the ::Pool management
* system.
*
* \param Alloc An allocation function or NULL to use a standard SCMalloc
* \param Init An init function or NULL to use a standard memset to 0
* \param InitData Init data
- * \Param Free a free function or NULL if no special treatment is needed
+ * \Param Cleanup a free function or NULL if no special treatment is needed
* \retval the allocated Pool
*/
-Pool *PoolInit(uint32_t size, uint32_t prealloc_size, uint32_t elt_size, void *(*Alloc)(), int (*Init)(void *, void *), void *InitData, void (*Free)(void *))
+Pool *PoolInit(uint32_t size, uint32_t prealloc_size, uint32_t elt_size, void *(*Alloc)(), int (*Init)(void *, void *), void *InitData, void (*Cleanup)(void *))
{
Pool *p = NULL;
p->Alloc = Alloc;
p->Init = Init;
p->InitData = InitData;
- p->Free = Free;
+ p->Cleanup = Cleanup;
if (p->Init == NULL) {
p->Init = PoolMemset;
p->InitData = p;
goto error;
}
if (p->Init(pb->data, p->InitData) != 1) {
- if (p->Free)
- p->Free(pb->data);
+ if (p->Cleanup)
+ p->Cleanup(pb->data);
SCFree(pb->data);
SCFree(pb);
goto error;
pb->data = (char *)p->data_buffer + u32 * elt_size;
if (p->Init(pb->data, p->InitData) != 1) {
- if (p->Free)
- p->Free(pb->data);
+ if (p->Cleanup)
+ p->Cleanup(pb->data);
goto error;
}
while (p->alloc_list != NULL) {
PoolBucket *pb = p->alloc_list;
p->alloc_list = pb->next;
- if (p->Free)
- p->Free(pb->data);
+ if (p->Cleanup)
+ p->Cleanup(pb->data);
if (PoolDataPreAllocated(p, pb->data) == 0) {
SCFree(pb->data);
}
PoolBucket *pb = p->empty_list;
p->empty_list = pb->next;
if (pb->data!= NULL) {
- if (p->Free)
- p->Free(pb->data);
+ if (p->Cleanup)
+ p->Cleanup(pb->data);
if (PoolDataPreAllocated(p, pb->data) == 0) {
SCFree(pb->data);
}
if (pb == NULL) {
p->allocated--;
p->outstanding--;
- if (p->Free != NULL) {
- p->Free(data);
+ if (p->Cleanup != NULL) {
+ p->Cleanup(data);
}
if (PoolDataPreAllocated(p, data) == 0)
SCFree(data);
goto end;
}
- if (p->Free != PoolTestFree) {
+ if (p->Cleanup != PoolTestFree) {
printf("Free func ptr %p != %p: ",
- p->Free, PoolTestFree);
+ p->Cleanup, PoolTestFree);
retval = 0;
goto end;
}
void *(*Alloc)();
int (*Init)(void *, void *);
void *InitData;
- void (*Free)(void *);
+ void (*Cleanup)(void *);
uint32_t elt_size;
uint32_t outstanding;