mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
TableType: Convert table_hash unique_ptr
Cannot remove the destructor as otherwise the compiler attempts to create its implementation in Type.h where CompositeHash isn't a complete type yet and std::unique_ptr's delete fails to be instantiated.
This commit is contained in:
parent
a11ee9038b
commit
be0a22fec2
2 changed files with 5 additions and 7 deletions
|
@ -484,7 +484,7 @@ TableType::TableType(TypeListPtr ind, TypePtr yield) : IndexType(TYPE_TABLE, std
|
||||||
RegenerateHash();
|
RegenerateHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
TableType::~TableType() { delete table_hash; }
|
TableType::~TableType() {}
|
||||||
|
|
||||||
bool TableType::CheckExpireFuncCompatibility(const detail::AttrPtr& attr) {
|
bool TableType::CheckExpireFuncCompatibility(const detail::AttrPtr& attr) {
|
||||||
if ( reported_error )
|
if ( reported_error )
|
||||||
|
@ -499,10 +499,7 @@ bool TableType::CheckExpireFuncCompatibility(const detail::AttrPtr& attr) {
|
||||||
|
|
||||||
TypePtr TableType::ShallowClone() { return make_intrusive<TableType>(indices, yield_type); }
|
TypePtr TableType::ShallowClone() { return make_intrusive<TableType>(indices, yield_type); }
|
||||||
|
|
||||||
void TableType::RegenerateHash() {
|
void TableType::RegenerateHash() { table_hash = std::make_unique<detail::CompositeHash>(GetIndices()); }
|
||||||
delete table_hash;
|
|
||||||
table_hash = new detail::CompositeHash(GetIndices());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TableType::IsUnspecifiedTable() const {
|
bool TableType::IsUnspecifiedTable() const {
|
||||||
// Unspecified types have an empty list of indices.
|
// Unspecified types have an empty list of indices.
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -402,7 +403,7 @@ public:
|
||||||
// what one gets using an empty "set()" or "table()" constructor.
|
// what one gets using an empty "set()" or "table()" constructor.
|
||||||
bool IsUnspecifiedTable() const;
|
bool IsUnspecifiedTable() const;
|
||||||
|
|
||||||
const detail::CompositeHash* GetTableHash() const { return table_hash; }
|
const detail::CompositeHash* GetTableHash() const { return table_hash.get(); }
|
||||||
|
|
||||||
// Called to rebuild the associated hash function when a record type
|
// Called to rebuild the associated hash function when a record type
|
||||||
// (that this table type depends on) gets redefined during parsing.
|
// (that this table type depends on) gets redefined during parsing.
|
||||||
|
@ -411,7 +412,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool DoExpireCheck(const detail::AttrPtr& attr);
|
bool DoExpireCheck(const detail::AttrPtr& attr);
|
||||||
|
|
||||||
detail::CompositeHash* table_hash = nullptr;
|
std::unique_ptr<detail::CompositeHash> table_hash;
|
||||||
|
|
||||||
// Used to prevent repeated error messages.
|
// Used to prevent repeated error messages.
|
||||||
bool reported_error = false;
|
bool reported_error = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue