|
|
|
@ -61,25 +61,24 @@ int PrefilterAddSidsResize(PrefilterRuleStore *pmq, uint32_t new_size);
|
|
|
|
|
static inline void PrefilterAddSids(
|
|
|
|
|
PrefilterRuleStore *pmq, const SigIntId *sids, uint32_t sids_size)
|
|
|
|
|
{
|
|
|
|
|
if (sids_size == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
uint32_t new_size = pmq->rule_id_array_cnt + sids_size;
|
|
|
|
|
if (new_size > pmq->rule_id_array_size) {
|
|
|
|
|
if (PrefilterAddSidsResize(pmq, new_size) == 0) {
|
|
|
|
|
// Failed to allocate larger memory for all the SIDS, but
|
|
|
|
|
// keep as many as we can.
|
|
|
|
|
sids_size = pmq->rule_id_array_size - pmq->rule_id_array_cnt;
|
|
|
|
|
if (sids_size > 0) {
|
|
|
|
|
uint32_t new_size = pmq->rule_id_array_cnt + sids_size;
|
|
|
|
|
if (new_size > pmq->rule_id_array_size) {
|
|
|
|
|
if (PrefilterAddSidsResize(pmq, new_size) == 0) {
|
|
|
|
|
// Failed to allocate larger memory for all the SIDS, but
|
|
|
|
|
// keep as many as we can.
|
|
|
|
|
sids_size = pmq->rule_id_array_size - pmq->rule_id_array_cnt;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
SCLogDebug("Adding %u sids", sids_size);
|
|
|
|
|
// Add SIDs for this pattern to the end of the array
|
|
|
|
|
SigIntId *ptr = pmq->rule_id_array + pmq->rule_id_array_cnt;
|
|
|
|
|
SigIntId *end = ptr + sids_size;
|
|
|
|
|
do {
|
|
|
|
|
*ptr++ = *sids++;
|
|
|
|
|
} while (ptr != end);
|
|
|
|
|
pmq->rule_id_array_cnt += sids_size;
|
|
|
|
|
}
|
|
|
|
|
SCLogDebug("Adding %u sids", sids_size);
|
|
|
|
|
// Add SIDs for this pattern to the end of the array
|
|
|
|
|
SigIntId *ptr = pmq->rule_id_array + pmq->rule_id_array_cnt;
|
|
|
|
|
SigIntId *end = ptr + sids_size;
|
|
|
|
|
do {
|
|
|
|
|
*ptr++ = *sids++;
|
|
|
|
|
} while (ptr != end);
|
|
|
|
|
pmq->rule_id_array_cnt += sids_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int PmqSetup(PrefilterRuleStore *);
|
|
|
|
|