mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +00:00
Merge remote-tracking branch 'origin/topic/vern/val-footprint-strings'
* origin/topic/vern/val-footprint-strings: refine Val "footprint" to equate long strings with multiple objects
This commit is contained in:
commit
cdcd83c8cc
8 changed files with 25 additions and 2 deletions
|
@ -855,6 +855,10 @@ StringValPtr StringVal::Replace(RE_Matcher* re, const String& repl, bool do_all)
|
|||
return make_intrusive<StringVal>(new String(true, result, r - result));
|
||||
}
|
||||
|
||||
unsigned int StringVal::ComputeFootprint(std::unordered_set<const Val*>* analyzed_vals) const {
|
||||
return 1 /* this object */ + static_cast<unsigned int>(Len()) / sizeof(Val);
|
||||
}
|
||||
|
||||
static std::variant<ValPtr, std::string> BuildVal(const rapidjson::Value& j, const TypePtr& t,
|
||||
const FuncPtr& key_func) {
|
||||
auto mismatch_err = [t, &j]() {
|
||||
|
|
|
@ -564,6 +564,8 @@ public:
|
|||
StringValPtr Replace(RE_Matcher* re, const String& repl, bool do_all);
|
||||
|
||||
protected:
|
||||
unsigned int ComputeFootprint(std::unordered_set<const Val*>* analyzed_vals) const override;
|
||||
|
||||
void ValDescribe(ODesc* d) const override;
|
||||
ValPtr DoClone(CloneState* state) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue