made RecordVal::AppendField protected: it's low-level & requires knowledge of internals

This commit is contained in:
Vern Paxson 2021-06-24 16:47:28 -07:00 committed by Tim Wojtulewicz
parent 80f0b099b5
commit d1334b7bca
3 changed files with 22 additions and 17 deletions

View file

@ -1,3 +1,7 @@
4.1.0-dev.823 | 2021-06-29 10:24:08 -0700
* made RecordVal::AppendField protected: it's low-level & requires knowledge of internals (Vern Paxson, Corelight)
4.1.0-dev.821 | 2021-06-29 08:38:37 -0700 4.1.0-dev.821 | 2021-06-29 08:38:37 -0700
* Fix package name for CMake on CentOS 8 (Dominik Charousset, Corelight) * Fix package name for CMake on CentOS 8 (Dominik Charousset, Corelight)

View file

@ -1 +1 @@
4.1.0-dev.821 4.1.0-dev.823

View file

@ -1182,22 +1182,6 @@ public:
Assign(idx, std::forward<T>(val)); Assign(idx, std::forward<T>(val));
} }
/**
* Appends a value to the record's fields. The caller is responsible
* for ensuring that fields are appended in the correct order and
* with the correct type. The type needs to be passed in because
* it's unsafe to take it from v when the field's type is "any" while
* v is a concrete type.
* @param v The value to append.
*/
void AppendField(ValPtr v, const TypePtr& t)
{
if ( v )
record_val->emplace_back(ZVal(v, t));
else
record_val->emplace_back(std::nullopt);
}
/** /**
* Returns the number of fields in the record. * Returns the number of fields in the record.
* @return The number of fields in the record. * @return The number of fields in the record.
@ -1422,6 +1406,23 @@ public:
protected: protected:
friend class zeek::detail::ZBody; friend class zeek::detail::ZBody;
/**
* Appends a value to the record's fields. The caller is responsible
* for ensuring that fields are appended in the correct order and
* with the correct type. The type needs to be passed in because
* it's unsafe to take it from v when the field's type is "any" while
* v is a concrete type.
* @param v The value to append.
* @param t The type associated with the field.
*/
void AppendField(ValPtr v, const TypePtr& t)
{
if ( v )
record_val->emplace_back(ZVal(v, t));
else
record_val->emplace_back(std::nullopt);
}
// For use by low-level ZAM instructions. Caller assumes // For use by low-level ZAM instructions. Caller assumes
// responsibility for memory management. The first version // responsibility for memory management. The first version
// allows manipulation of whether the field is present at all. // allows manipulation of whether the field is present at all.