Remove deprecated MemoryAllocation() methods and related code

This commit is contained in:
Tim Wojtulewicz 2022-06-15 14:54:47 -07:00
parent d3169e48c0
commit 70e63d4749
39 changed files with 15 additions and 659 deletions

View file

@ -258,11 +258,6 @@ ValPtr Val::SizeVal() const
return val_mgr->Count(0);
}
unsigned int Val::MemoryAllocation() const
{
return padded_sizeof(*this);
}
bool Val::AddTo(Val* v, bool is_first_init) const
{
Error("+= initializer only applies to aggregate values");
@ -807,14 +802,6 @@ AddrVal::~AddrVal()
delete addr_val;
}
unsigned int AddrVal::MemoryAllocation() const
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return padded_sizeof(*this) + addr_val->MemoryAllocation();
#pragma GCC diagnostic pop
}
ValPtr AddrVal::SizeVal() const
{
if ( addr_val->GetFamily() == IPv4 )
@ -877,14 +864,6 @@ int SubNetVal::Width() const
return subnet_val->Length();
}
unsigned int SubNetVal::MemoryAllocation() const
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return padded_sizeof(*this) + subnet_val->MemoryAllocation();
#pragma GCC diagnostic pop
}
ValPtr SubNetVal::SizeVal() const
{
int retained = 128 - subnet_val->LengthIPv6();
@ -1002,14 +981,6 @@ void StringVal::ValDescribe(ODesc* d) const
d->Add("\"");
}
unsigned int StringVal::MemoryAllocation() const
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return padded_sizeof(*this) + string_val->MemoryAllocation();
#pragma GCC diagnostic pop
}
StringValPtr StringVal::Replace(RE_Matcher* re, const String& repl, bool do_all)
{
const u_char* s = Bytes();
@ -1210,14 +1181,6 @@ void PatternVal::ValDescribe(ODesc* d) const
d->Add("/");
}
unsigned int PatternVal::MemoryAllocation() const
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return padded_sizeof(*this) + re_val->MemoryAllocation();
#pragma GCC diagnostic pop
}
ValPtr PatternVal::DoClone(CloneState* state)
{
// We could likely treat this type as immutable and return a reference
@ -1332,19 +1295,6 @@ unsigned int ListVal::ComputeFootprint(std::unordered_set<const Val*>* analyzed_
return fp;
}
unsigned int ListVal::MemoryAllocation() const
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
unsigned int size = 0;
for ( const auto& val : vals )
size += val->MemoryAllocation();
size += util::pad_size(vals.capacity() * sizeof(decltype(vals)::value_type));
return size + padded_sizeof(*this) + type->MemoryAllocation();
#pragma GCC diagnostic pop
}
TableEntryVal* TableEntryVal::Clone(Val::CloneState* state)
{
auto rval = new TableEntryVal(val ? val->Clone(state) : nullptr);
@ -2724,25 +2674,6 @@ unsigned int TableVal::ComputeFootprint(std::unordered_set<const Val*>* analyzed
return fp;
}
unsigned int TableVal::MemoryAllocation() const
{
unsigned int size = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
for ( const auto& ve : *table_val )
{
auto* tv = ve.GetValue<TableEntryVal*>();
if ( tv->GetVal() )
size += tv->GetVal()->MemoryAllocation();
size += padded_sizeof(TableEntryVal);
}
return size + padded_sizeof(*this) + table_val->MemoryAllocation() +
table_hash->MemoryAllocation();
#pragma GCC diagnostic pop
}
std::unique_ptr<detail::HashKey> TableVal::MakeHashKey(const Val& index) const
{
return table_hash->MakeHashKey(index, true);
@ -3107,27 +3038,6 @@ unsigned int RecordVal::ComputeFootprint(std::unordered_set<const Val*>* analyze
return fp;
}
unsigned int RecordVal::MemoryAllocation() const
{
unsigned int size = 0;
int n = NumFields();
for ( auto i = 0; i < n; ++i )
{
auto f_i = GetField(i);
if ( f_i )
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
size += f_i->MemoryAllocation();
#pragma GCC diagnostic pop
}
size += util::pad_size(record_val->capacity() * sizeof(ZVal));
size += padded_sizeof(*record_val);
return size + padded_sizeof(*this);
}
ValPtr EnumVal::SizeVal() const
{
return val_mgr->Int(AsInt());