mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Provide access to scratch in queues
This largely reverts commit f8ecf33236b0695d9539e8e34cf0bb0467614cdf.
This commit is contained in:
parent
cb7067f59d
commit
a8aa2d022f
@ -91,6 +91,7 @@ struct mq {
|
|||||||
* history buffer; (logically) immediately before the
|
* history buffer; (logically) immediately before the
|
||||||
* main buffer */
|
* main buffer */
|
||||||
size_t hlength; /**< length of the history buffer */
|
size_t hlength; /**< length of the history buffer */
|
||||||
|
struct hs_scratch *scratch; /**< global scratch space */
|
||||||
char report_current; /**<
|
char report_current; /**<
|
||||||
* report_current matches at starting offset through
|
* report_current matches at starting offset through
|
||||||
* callback. If true, the queue must be located at a
|
* callback. If true, the queue must be located at a
|
||||||
|
@ -227,6 +227,11 @@ hs_error_t alloc_scratch(const hs_scratch_t *proto, hs_scratch_t **scratch) {
|
|||||||
// Don't get too big for your boots
|
// Don't get too big for your boots
|
||||||
assert((size_t)(current - (char *)s) <= alloc_size);
|
assert((size_t)(current - (char *)s) <= alloc_size);
|
||||||
|
|
||||||
|
// Init q->scratch ptr for every queue.
|
||||||
|
for (struct mq *qi = s->queues; qi != s->queues + queueCount; ++qi) {
|
||||||
|
qi->scratch = s;
|
||||||
|
}
|
||||||
|
|
||||||
return HS_SUCCESS;
|
return HS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ protected:
|
|||||||
q.length = 0; // filled in by test
|
q.length = 0; // filled in by test
|
||||||
q.history = nullptr;
|
q.history = nullptr;
|
||||||
q.hlength = 0;
|
q.hlength = 0;
|
||||||
|
q.scratch = nullptr; // not needed by LBR
|
||||||
q.report_current = 0;
|
q.report_current = 0;
|
||||||
q.cb = onMatch;
|
q.cb = onMatch;
|
||||||
q.som_cb = nullptr; // only used by Haig
|
q.som_cb = nullptr; // only used by Haig
|
||||||
|
@ -102,6 +102,7 @@ protected:
|
|||||||
q.length = SCAN_DATA.size();
|
q.length = SCAN_DATA.size();
|
||||||
q.history = nullptr;
|
q.history = nullptr;
|
||||||
q.hlength = 0;
|
q.hlength = 0;
|
||||||
|
q.scratch = nullptr; /* limex does not use scratch */
|
||||||
q.report_current = 0;
|
q.report_current = 0;
|
||||||
q.cb = onMatch;
|
q.cb = onMatch;
|
||||||
q.som_cb = nullptr; // only used by Haig
|
q.som_cb = nullptr; // only used by Haig
|
||||||
@ -396,6 +397,7 @@ protected:
|
|||||||
q.length = ZOMBIE_SCAN_DATA.length();
|
q.length = ZOMBIE_SCAN_DATA.length();
|
||||||
q.history = nullptr;
|
q.history = nullptr;
|
||||||
q.hlength = 0;
|
q.hlength = 0;
|
||||||
|
q.scratch = nullptr; /* limex does not use scratch */
|
||||||
q.report_current = 0;
|
q.report_current = 0;
|
||||||
q.cb = onMatch;
|
q.cb = onMatch;
|
||||||
q.som_cb = nullptr; // only used by Haig
|
q.som_cb = nullptr; // only used by Haig
|
||||||
|
Loading…
x
Reference in New Issue
Block a user