mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-18 18:20:35 +03:00
literal matchers: change context passed to callback to scratch
This commit is contained in:
committed by
Matthew Barr
parent
bc232d272f
commit
67a8f43355
@@ -94,7 +94,7 @@ const u8 * floodDetect(const struct FDR * fdr,
|
||||
const u8 * buf = a->buf;
|
||||
const size_t len = a->len;
|
||||
HWLMCallback cb = a->cb;
|
||||
void * ctxt = a->ctxt;
|
||||
struct hs_scratch *scratch = a->scratch;
|
||||
|
||||
const u8 * ptr = *ptrPtr;
|
||||
// tryFloodDetect is never put in places where unconditional
|
||||
@@ -197,67 +197,67 @@ const u8 * floodDetect(const struct FDR * fdr,
|
||||
t += 4) {
|
||||
DEBUG_PRINTF("aaa %u %llx\n", t, fl->groups[0]);
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 0, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 0, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 1, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 2, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 2, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 3, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 3, fl->ids[0], scratch);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t += 4) {
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t, fl->ids[0], ctxt);
|
||||
*control = cb(i + t, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t, fl->ids[1], ctxt);
|
||||
*control = cb(i + t, fl->ids[1], scratch);
|
||||
}
|
||||
if (*control & fl->groups[0]) {
|
||||
*control =
|
||||
cb(i + t + 1, fl->ids[0], ctxt);
|
||||
cb(i + t + 1, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t + 1, fl->ids[1], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[1], scratch);
|
||||
}
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 2, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 2, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t + 2, fl->ids[1], ctxt);
|
||||
*control = cb(i + t + 2, fl->ids[1], scratch);
|
||||
}
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 3, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 3, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t + 3, fl->ids[1], ctxt);
|
||||
*control = cb(i + t + 3, fl->ids[1], scratch);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t += 2) {
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t, fl->ids[0], ctxt);
|
||||
*control = cb(i + t, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t, fl->ids[1], ctxt);
|
||||
*control = cb(i + t, fl->ids[1], scratch);
|
||||
}
|
||||
if (*control & fl->groups[2]) {
|
||||
*control = cb(i + t, fl->ids[2], ctxt);
|
||||
*control = cb(i + t, fl->ids[2], scratch);
|
||||
}
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 1, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t + 1, fl->ids[1], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[1], scratch);
|
||||
}
|
||||
if (*control & fl->groups[2]) {
|
||||
*control = cb(i + t + 1, fl->ids[2], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[2], scratch);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -266,40 +266,40 @@ const u8 * floodDetect(const struct FDR * fdr,
|
||||
for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t += 2) {
|
||||
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t, fl->ids[0], ctxt);
|
||||
*control = cb(i + t, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t, fl->ids[1], ctxt);
|
||||
*control = cb(i + t, fl->ids[1], scratch);
|
||||
}
|
||||
if (*control & fl->groups[2]) {
|
||||
*control = cb(i + t, fl->ids[2], ctxt);
|
||||
*control = cb(i + t, fl->ids[2], scratch);
|
||||
}
|
||||
if (*control & fl->groups[3]) {
|
||||
*control = cb(i + t, fl->ids[3], ctxt);
|
||||
*control = cb(i + t, fl->ids[3], scratch);
|
||||
}
|
||||
|
||||
for (u32 t2 = 4; t2 < fl->idCount; t2++) {
|
||||
if (*control & fl->groups[t2]) {
|
||||
*control = cb(i + t, fl->ids[t2], ctxt);
|
||||
*control = cb(i + t, fl->ids[t2], scratch);
|
||||
}
|
||||
}
|
||||
|
||||
if (*control & fl->groups[0]) {
|
||||
*control = cb(i + t + 1, fl->ids[0], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[0], scratch);
|
||||
}
|
||||
if (*control & fl->groups[1]) {
|
||||
*control = cb(i + t + 1, fl->ids[1], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[1], scratch);
|
||||
}
|
||||
if (*control & fl->groups[2]) {
|
||||
*control = cb(i + t + 1, fl->ids[2], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[2], scratch);
|
||||
}
|
||||
if (*control & fl->groups[3]) {
|
||||
*control = cb(i + t + 1, fl->ids[3], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[3], scratch);
|
||||
}
|
||||
|
||||
for (u32 t2 = 4; t2 < fl->idCount; t2++) {
|
||||
if (*control & fl->groups[t2]) {
|
||||
*control = cb(i + t + 1, fl->ids[t2], ctxt);
|
||||
*control = cb(i + t + 1, fl->ids[t2], scratch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ const u8 * floodDetect(const struct FDR * fdr,
|
||||
for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t++) {
|
||||
for (u32 t2 = 0; t2 < fl->idCount; t2++) {
|
||||
if (*control & fl->groups[t2]) {
|
||||
*control = cb(i + t, fl->ids[t2], ctxt);
|
||||
*control = cb(i + t, fl->ids[t2], scratch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user