44 void *(*Alloc)(
void),
int (*Init)(
void *),
void (*Cleanup)(
void *))
63 if (pt->
array == NULL) {
70 for (
int i = 0; i < threads; i++) {
78 e->
pool =
PoolInit(size, prealloc_size, elt_size, Alloc, Init, Cleanup);
80 if (e->
pool == NULL) {
98 if (pt == NULL || pt->
array == NULL || pt->
size == 0) {
103 size_t newsize = pt->
size + 1;
104 SCLogDebug(
"newsize %"PRIuMAX, (uintmax_t)newsize);
118 memset(&settings, 0x0,
sizeof(settings));
129 e = &pt->
array[newsize - 1];
130 memset(e, 0x00,
sizeof(*e));
136 if (e->
pool == NULL) {
141 return (
int)(newsize - 1);
148 return (
int)pt->
size;
156 if (pt->
array != NULL) {
157 for (
int i = 0; i < (int)pt->
size; i++) {
173 if (pt == NULL ||
id >= pt->
size)
192 if (pt == NULL || *
id >= pt->
size)
230 static void *PoolThreadTestAlloc(
void)
237 void PoolThreadTestFree(
void *data)
241 static int PoolThreadTestInit01(
void)
244 10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
250 static int PoolThreadTestInit02(
void)
253 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
259 static int PoolThreadTestGet01(
void)
262 10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
275 static int PoolThreadTestGet02(
void)
278 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
291 static int PoolThreadTestReturn01(
void)
294 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
313 static int PoolThreadTestGrow01(
void)
316 10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
324 static int PoolThreadTestGrow02(
void)
327 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
335 static int PoolThreadTestGrow03(
void)
338 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);