mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Merge branch 'leaks' of https://github.com/MaxKellermann/zeek
Only one instance of base_type() getting a NewRef instead of AdoptRef fixed in merge. All other changes are superficial formatting and factoring. * 'leaks' of https://github.com/MaxKellermann/zeek: (22 commits) Stmt: use class IntrusivePtr Stmt: remove unused default constructors and `friend` declarations Val: remove unimplemented prototype recover_val() Val: cast_value_to_type() returns IntrusivePtr Val: use IntrusivePtr in check_and_promote() Val: use nullptr instead of 0 zeekygen: use class IntrusivePtr ID: use class IntrusivePtr Expr: use class IntrusivePtr Var: copy Location to stack, to fix use-after-free crash bug Scope: lookup_ID() and install_ID() return IntrusivePtr<ID> Scope: delete duplicate locals EventRegistry: automatically delete EventHandlers main: destroy event_registry after iosource_mgr zeekygen/IdentifierInfo: delete duplicate fields main: free the global scope in terminate_bro() Scope: pop_scope() returns IntrusivePtr<> Scope: unref all inits in destructor Var: pass IntrusivePtr to add_global(), add_local() etc. plugin/ComponentManager: hold a reference to the EnumType ...
This commit is contained in:
commit
cf196bb148
41 changed files with 1864 additions and 2095 deletions
14
src/Val.h
14
src/Val.h
|
@ -29,6 +29,7 @@ using std::string;
|
|||
|
||||
template <class T> class IntrusivePtr;
|
||||
template<typename T> class PDict;
|
||||
template <class T> class IntrusivePtr;
|
||||
class IterCookie;
|
||||
|
||||
class Val;
|
||||
|
@ -1018,13 +1019,9 @@ protected:
|
|||
// Unref()'ing the original. If not a match, generates an error message
|
||||
// and returns nil, also Unref()'ing v. If is_init is true, then
|
||||
// the checking is done in the context of an initialization.
|
||||
extern Val* check_and_promote(Val* v, const BroType* t, int is_init, const Location* expr_location = nullptr);
|
||||
|
||||
// Given a pointer to where a Val's core (i.e., its BRO value) resides,
|
||||
// returns a corresponding newly-created or Ref()'d Val. ptr must already
|
||||
// be properly aligned. Returns the size of the core in bytes in 'n'.
|
||||
// If t corresponds to a variable-length type, n must give the size on entry.
|
||||
Val* recover_val(void* ptr, BroType* t, int& n);
|
||||
extern IntrusivePtr<Val> check_and_promote(IntrusivePtr<Val> v,
|
||||
const BroType* t, int is_init,
|
||||
const Location* expr_location = nullptr);
|
||||
|
||||
extern int same_val(const Val* v1, const Val* v2);
|
||||
extern int same_atomic_val(const Val* v1, const Val* v2);
|
||||
|
@ -1036,10 +1033,9 @@ extern void delete_vals(val_list* vals);
|
|||
inline bool is_vector(Val* v) { return v->Type()->Tag() == TYPE_VECTOR; }
|
||||
|
||||
// Returns v casted to type T if the type supports that. Returns null if not.
|
||||
// The returned value will be ref'ed.
|
||||
//
|
||||
// Note: This implements the script-level cast operator.
|
||||
extern Val* cast_value_to_type(Val* v, BroType* t);
|
||||
extern IntrusivePtr<Val> cast_value_to_type(Val* v, BroType* t);
|
||||
|
||||
// Returns true if v can be casted to type T. If so, check_and_cast() will
|
||||
// succeed as well.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue