Rename BroObj to Obj

This commit is contained in:
Tim Wojtulewicz 2020-07-02 15:42:00 -07:00
parent 736a3f53d4
commit 02cef05f93
36 changed files with 105 additions and 103 deletions

View file

@ -55,9 +55,9 @@ inline void set_location(const Location start, const Location end)
} // namespace detail
class BroObj {
class Obj {
public:
BroObj()
Obj()
{
// A bit of a hack. We'd like to associate location
// information with every object created when parsing,
@ -77,18 +77,18 @@ public:
SetLocationInfo(&detail::start_location, &detail::end_location);
}
virtual ~BroObj();
virtual ~Obj();
/* disallow copying */
BroObj(const BroObj &) = delete;
BroObj &operator=(const BroObj &) = delete;
Obj(const Obj &) = delete;
Obj &operator=(const Obj &) = delete;
// Report user warnings/errors. If obj2 is given, then it's
// included in the message, though if pinpoint_only is non-zero,
// then obj2 is only used to pinpoint the location.
void Warn(const char* msg, const BroObj* obj2 = nullptr,
void Warn(const char* msg, const Obj* obj2 = nullptr,
bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const;
void Error(const char* msg, const BroObj* obj2 = nullptr,
void Error(const char* msg, const Obj* obj2 = nullptr,
bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const;
// Report internal errors.
@ -130,8 +130,8 @@ public:
// as long as there exist any instances.
class SuppressErrors {
public:
SuppressErrors() { ++BroObj::suppress_errors; }
~SuppressErrors() { --BroObj::suppress_errors; }
SuppressErrors() { ++Obj::suppress_errors; }
~SuppressErrors() { --Obj::suppress_errors; }
};
void Print() const;
@ -142,13 +142,13 @@ protected:
private:
friend class SuppressErrors;
void DoMsg(ODesc* d, const char s1[], const BroObj* obj2 = nullptr,
void DoMsg(ODesc* d, const char s1[], const Obj* obj2 = nullptr,
bool pinpoint_only = false, const detail::Location* expr_location = nullptr) const;
void PinPoint(ODesc* d, const BroObj* obj2 = nullptr,
void PinPoint(ODesc* d, const Obj* obj2 = nullptr,
bool pinpoint_only = false) const;
friend inline void Ref(BroObj* o);
friend inline void Unref(BroObj* o);
friend inline void Ref(Obj* o);
friend inline void Unref(Obj* o);
bool notify_plugins = false;
int ref_cnt = 1;
@ -158,16 +158,16 @@ private:
static int suppress_errors;
};
// Sometimes useful when dealing with BroObj subclasses that have their
// Sometimes useful when dealing with Obj subclasses that have their
// own (protected) versions of Error.
inline void Error(const BroObj* o, const char* msg)
inline void Error(const Obj* o, const char* msg)
{
o->Error(msg);
}
[[noreturn]] extern void bad_ref(int type);
inline void Ref(BroObj* o)
inline void Ref(Obj* o)
{
if ( ++(o->ref_cnt) <= 1 )
bad_ref(0);
@ -175,7 +175,7 @@ inline void Ref(BroObj* o)
bad_ref(1);
}
inline void Unref(BroObj* o)
inline void Unref(Obj* o)
{
if ( o && --o->ref_cnt <= 0 )
{
@ -184,18 +184,18 @@ inline void Unref(BroObj* o)
delete o;
// We could do the following if o were passed by reference.
// o = (BroObj*) 0xcd;
// o = (Obj*) 0xcd;
}
}
// A dict_delete_func that knows to Unref() dictionary entries.
extern void bro_obj_delete_func(void* v);
extern void obj_delete_func(void* v);
} // namespace zeek
using Location [[deprecated("Remove in v4.1. Use zeek::detail::Location instead.")]] = zeek::detail::Location;
using yyltype [[deprecated("Remove in v4.1. Use zeek::detail::yyltype instead.")]] = zeek::detail::yyltype;
using BroObj [[deprecated("Remove in v4.1. Use zeek::BroObj instead.")]] = zeek::BroObj;
using BroObj [[deprecated("Remove in v4.1. Use zeek::Obj instead.")]] = zeek::Obj;
[[deprecated("Remove in v4.1. Use zeek::BroObj::Print instead.")]]
extern void print(const zeek::BroObj* obj);
[[deprecated("Remove in v4.1. Use zeek::Obj::Print instead.")]]
extern void print(const zeek::Obj* obj);