mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 04:58:21 +00:00
TablePatternMatcher: Use unique_ptr
This commit is contained in:
parent
c8bab6a0ec
commit
43a5473919
1 changed files with 3 additions and 7 deletions
10
src/Val.cc
10
src/Val.cc
|
@ -1436,15 +1436,11 @@ public:
|
||||||
TablePatternMatcher(const TableVal* _tbl, TypePtr _yield) : tbl(_tbl) {
|
TablePatternMatcher(const TableVal* _tbl, TypePtr _yield) : tbl(_tbl) {
|
||||||
vtype = make_intrusive<VectorType>(std::move(_yield));
|
vtype = make_intrusive<VectorType>(std::move(_yield));
|
||||||
}
|
}
|
||||||
~TablePatternMatcher() { Clear(); }
|
|
||||||
|
|
||||||
void Insert(ValPtr pat, ValPtr yield) { Clear(); }
|
void Insert(ValPtr pat, ValPtr yield) { Clear(); }
|
||||||
void Remove(ValPtr pat) { Clear(); }
|
void Remove(ValPtr pat) { Clear(); }
|
||||||
|
|
||||||
void Clear() {
|
void Clear() { matcher.reset(); }
|
||||||
delete matcher;
|
|
||||||
matcher = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
VectorValPtr Lookup(const StringVal* s);
|
VectorValPtr Lookup(const StringVal* s);
|
||||||
|
|
||||||
|
@ -1461,7 +1457,7 @@ private:
|
||||||
// from having to re-build the matcher on every insert/delete in
|
// from having to re-build the matcher on every insert/delete in
|
||||||
// the common case that a whole bunch of those are done in a single
|
// the common case that a whole bunch of those are done in a single
|
||||||
// batch.
|
// batch.
|
||||||
RE_DisjunctiveMatcher* matcher = nullptr;
|
std::unique_ptr<RE_DisjunctiveMatcher> matcher = nullptr;
|
||||||
|
|
||||||
// Maps matcher values to corresponding yields. When building the
|
// Maps matcher values to corresponding yields. When building the
|
||||||
// matcher we insert a nil at the head to accommodate how
|
// matcher we insert a nil at the head to accommodate how
|
||||||
|
@ -1511,7 +1507,7 @@ void TablePatternMatcher::Build() {
|
||||||
hash_key_vals.push_back(std::move(vl));
|
hash_key_vals.push_back(std::move(vl));
|
||||||
}
|
}
|
||||||
|
|
||||||
matcher = new RE_DisjunctiveMatcher(patterns);
|
matcher = std::make_unique<RE_DisjunctiveMatcher>(patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableVal::TableVal(TableTypePtr t, detail::AttributesPtr a) : Val(t) {
|
TableVal::TableVal(TableTypePtr t, detail::AttributesPtr a) : Val(t) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue