mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
rose_build_anchored: take ref, not pointer
This commit is contained in:
parent
69682ed263
commit
1c2fca8840
@ -217,12 +217,8 @@ void populate_holder(const simple_anchored_info &sai, const set<u32> &exit_ids,
|
||||
h[v].reports.insert(exit_ids.begin(), exit_ids.end());
|
||||
}
|
||||
|
||||
u32 anchoredStateSize(const anchored_matcher_info *atable) {
|
||||
if (!atable) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct anchored_matcher_info *curr = atable;
|
||||
u32 anchoredStateSize(const anchored_matcher_info &atable) {
|
||||
const struct anchored_matcher_info *curr = &atable;
|
||||
|
||||
// Walk the list until we find the last element; total state size will be
|
||||
// that engine's state offset plus its state requirement.
|
||||
@ -235,8 +231,8 @@ u32 anchoredStateSize(const anchored_matcher_info *atable) {
|
||||
return curr->state_offset + nfa->scratchStateSize;
|
||||
}
|
||||
|
||||
bool anchoredIsMulti(const anchored_matcher_info *atable) {
|
||||
return atable && atable->next_offset;
|
||||
bool anchoredIsMulti(const anchored_matcher_info &atable) {
|
||||
return atable.next_offset;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -50,13 +50,13 @@ struct Grey;
|
||||
aligned_unique_ptr<anchored_matcher_info>
|
||||
buildAnchoredAutomataMatcher(RoseBuildImpl &build, size_t *asize);
|
||||
|
||||
u32 anchoredStateSize(const anchored_matcher_info *atable);
|
||||
u32 anchoredStateSize(const anchored_matcher_info &atable);
|
||||
|
||||
/**
|
||||
* \brief True if there is an anchored matcher and it consists of multiple
|
||||
* DFAs.
|
||||
*/
|
||||
bool anchoredIsMulti(const anchored_matcher_info *atable);
|
||||
bool anchoredIsMulti(const anchored_matcher_info &atable);
|
||||
|
||||
#define ANCHORED_FAIL 0
|
||||
#define ANCHORED_SUCCESS 1
|
||||
|
@ -2245,7 +2245,7 @@ void enforceEngineSizeLimit(const NFA *n, const size_t nfa_size, const Grey &gre
|
||||
static
|
||||
u32 findMinFloatingLiteralMatch(const RoseBuildImpl &build,
|
||||
const anchored_matcher_info *atable) {
|
||||
if (anchoredIsMulti(atable)) {
|
||||
if (atable && anchoredIsMulti(*atable)) {
|
||||
DEBUG_PRINTF("multiple anchored dfas\n");
|
||||
/* We must regard matches from other anchored tables as unordered, as
|
||||
* we do for floating matches. */
|
||||
@ -4199,7 +4199,7 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
|
||||
// Build engine header and copy tables into place.
|
||||
|
||||
u32 anchorStateSize = anchoredStateSize(atable.get());
|
||||
u32 anchorStateSize = atable ? anchoredStateSize(*atable) : 0;
|
||||
|
||||
DEBUG_PRINTF("rose history required %zu\n", historyRequired);
|
||||
assert(!cc.streaming || historyRequired <= cc.grey.maxHistoryAvailable);
|
||||
@ -4372,7 +4372,7 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
write_out(&engine->state_init, (char *)engine.get(), state_scatter,
|
||||
state_scatter_aux_offset);
|
||||
|
||||
if (anchoredIsMulti(atable.get())) {
|
||||
if (atable && anchoredIsMulti(*atable)) {
|
||||
engine->maxSafeAnchoredDROffset = 1;
|
||||
} else {
|
||||
/* overly conservative, really need the min offset of non dr anchored
|
||||
|
Loading…
x
Reference in New Issue
Block a user