|
|
|
@ -301,21 +301,24 @@ void *PoolGet(Pool *p) {
|
|
|
|
if (p->max_buckets == 0 || p->allocated < p->max_buckets) {
|
|
|
|
if (p->max_buckets == 0 || p->allocated < p->max_buckets) {
|
|
|
|
void *pitem;
|
|
|
|
void *pitem;
|
|
|
|
SCLogDebug("max_buckets %"PRIu32"", p->max_buckets);
|
|
|
|
SCLogDebug("max_buckets %"PRIu32"", p->max_buckets);
|
|
|
|
p->allocated++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p->outstanding++;
|
|
|
|
|
|
|
|
if (p->outstanding > p->max_outstanding)
|
|
|
|
|
|
|
|
p->max_outstanding = p->outstanding;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (p->Alloc != NULL) {
|
|
|
|
if (p->Alloc != NULL) {
|
|
|
|
pitem = p->Alloc();
|
|
|
|
pitem = p->Alloc();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pitem = SCMalloc(p->elt_size);
|
|
|
|
pitem = SCMalloc(p->elt_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pitem != NULL) {
|
|
|
|
if (pitem != NULL) {
|
|
|
|
if (p->Init(pitem, p->InitData) != 1)
|
|
|
|
if (p->Init(pitem, p->InitData) != 1)
|
|
|
|
SCReturnPtr(NULL, "void");
|
|
|
|
SCReturnPtr(NULL, "void");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p->allocated++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p->outstanding++;
|
|
|
|
|
|
|
|
if (p->outstanding > p->max_outstanding)
|
|
|
|
|
|
|
|
p->max_outstanding = p->outstanding;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCReturnPtr(pitem, "void");
|
|
|
|
SCReturnPtr(pitem, "void");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
SCReturnPtr(NULL, "void");
|
|
|
|
SCReturnPtr(NULL, "void");
|
|
|
|
|