45 void *(*Alloc)(
void),
int (*Init)(
void *),
void (*Cleanup)(
void *))
64 if (pt->
array == NULL) {
71 for (
int i = 0; i < threads; i++) {
79 e->
pool =
PoolInit(size, prealloc_size, elt_size, Alloc, Init, Cleanup);
81 if (e->
pool == NULL) {
99 if (pt == NULL || pt->
array == NULL || pt->
size == 0) {
104 size_t newsize = pt->
size + 1;
105 SCLogDebug(
"newsize %"PRIuMAX, (uintmax_t)newsize);
119 memset(&settings, 0x0,
sizeof(settings));
130 e = &pt->
array[newsize - 1];
131 memset(e, 0x00,
sizeof(*e));
137 if (e->
pool == NULL) {
142 return (
int)(newsize - 1);
149 return (
int)pt->
size;
157 if (pt->
array != NULL) {
158 for (
int i = 0; i < (int)pt->
size; i++) {
174 if (pt == NULL ||
id >= pt->
size)
193 if (pt == NULL || *
id >= pt->
size)
231 static void *PoolThreadTestAlloc(
void)
238 void PoolThreadTestFree(
void *data)
242 static int PoolThreadTestInit01(
void)
245 10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
251 static int PoolThreadTestInit02(
void)
254 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
260 static int PoolThreadTestGet01(
void)
263 10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
276 static int PoolThreadTestGet02(
void)
279 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
292 static int PoolThreadTestReturn01(
void)
295 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
314 static int PoolThreadTestGrow01(
void)
317 10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
325 static int PoolThreadTestGrow02(
void)
328 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);
336 static int PoolThreadTestGrow03(
void)
339 10, 5, 10, PoolThreadTestAlloc, NULL, PoolThreadTestFree);