Base: Clean up explicit uses of namespaces in places where they're not necessary.

This commit covers all of the common and base classes.
This commit is contained in:
Tim Wojtulewicz 2020-08-21 09:29:37 -07:00
parent 9f802b2a4d
commit fe0c22c789
240 changed files with 6823 additions and 6787 deletions

View file

@ -16,7 +16,7 @@ namespace detail {
Location start_location("<start uninitialized>", 0, 0, 0, 0);
Location end_location("<end uninitialized>", 0, 0, 0, 0);
void Location::Describe(zeek::ODesc* d) const
void Location::Describe(ODesc* d) const
{
if ( filename )
{
@ -45,7 +45,7 @@ void Location::Describe(zeek::ODesc* d) const
bool Location::operator==(const Location& l) const
{
if ( filename == l.filename ||
(filename && l.filename && zeek::util::streq(filename, l.filename)) )
(filename && l.filename && util::streq(filename, l.filename)) )
return first_line == l.first_line && last_line == l.last_line;
else
return false;
@ -65,10 +65,10 @@ Obj::~Obj()
void Obj::Warn(const char* msg, const Obj* obj2, bool pinpoint_only, const detail::Location* expr_location) const
{
zeek::ODesc d;
ODesc d;
DoMsg(&d, msg, obj2, pinpoint_only, expr_location);
zeek::reporter->Warning("%s", d.Description());
zeek::reporter->PopLocation();
reporter->Warning("%s", d.Description());
reporter->PopLocation();
}
void Obj::Error(const char* msg, const Obj* obj2, bool pinpoint_only, const detail::Location* expr_location) const
@ -76,10 +76,10 @@ void Obj::Error(const char* msg, const Obj* obj2, bool pinpoint_only, const deta
if ( suppress_errors )
return;
zeek::ODesc d;
ODesc d;
DoMsg(&d, msg, obj2, pinpoint_only, expr_location);
zeek::reporter->Error("%s", d.Description());
zeek::reporter->PopLocation();
reporter->Error("%s", d.Description());
reporter->PopLocation();
}
void Obj::BadTag(const char* msg, const char* t1, const char* t2) const
@ -93,35 +93,35 @@ void Obj::BadTag(const char* msg, const char* t1, const char* t2) const
else
snprintf(out, sizeof(out), "%s", msg);
zeek::ODesc d;
ODesc d;
DoMsg(&d, out);
zeek::reporter->FatalErrorWithCore("%s", d.Description());
zeek::reporter->PopLocation();
reporter->FatalErrorWithCore("%s", d.Description());
reporter->PopLocation();
}
void Obj::Internal(const char* msg) const
{
zeek::ODesc d;
ODesc d;
DoMsg(&d, msg);
auto rcs = zeek::render_call_stack();
auto rcs = render_call_stack();
if ( rcs.empty() )
zeek::reporter->InternalError("%s", d.Description());
reporter->InternalError("%s", d.Description());
else
zeek::reporter->InternalError("%s, call stack: %s", d.Description(), rcs.data());
reporter->InternalError("%s, call stack: %s", d.Description(), rcs.data());
zeek::reporter->PopLocation();
reporter->PopLocation();
}
void Obj::InternalWarning(const char* msg) const
{
zeek::ODesc d;
ODesc d;
DoMsg(&d, msg);
zeek::reporter->InternalWarning("%s", d.Description());
zeek::reporter->PopLocation();
reporter->InternalWarning("%s", d.Description());
reporter->PopLocation();
}
void Obj::AddLocation(zeek::ODesc* d) const
void Obj::AddLocation(ODesc* d) const
{
if ( ! location )
{
@ -137,10 +137,10 @@ bool Obj::SetLocationInfo(const detail::Location* start, const detail::Location*
if ( ! start || ! end )
return false;
if ( end->filename && ! zeek::util::streq(start->filename, end->filename) )
if ( end->filename && ! util::streq(start->filename, end->filename) )
return false;
if ( location && (start == &zeek::detail::no_location || end == &zeek::detail::no_location) )
if ( location && (start == &detail::no_location || end == &detail::no_location) )
// We already have a better location, so don't use this one.
return true;
@ -162,7 +162,7 @@ void Obj::UpdateLocationEndInfo(const detail::Location& end)
location->last_column = end.last_column;
}
void Obj::DoMsg(zeek::ODesc* d, const char s1[], const Obj* obj2,
void Obj::DoMsg(ODesc* d, const char s1[], const Obj* obj2,
bool pinpoint_only, const detail::Location* expr_location) const
{
d->SetShort();
@ -171,16 +171,16 @@ void Obj::DoMsg(zeek::ODesc* d, const char s1[], const Obj* obj2,
PinPoint(d, obj2, pinpoint_only);
const detail::Location* loc2 = nullptr;
if ( obj2 && obj2->GetLocationInfo() != &zeek::detail::no_location &&
if ( obj2 && obj2->GetLocationInfo() != &detail::no_location &&
*obj2->GetLocationInfo() != *GetLocationInfo() )
loc2 = obj2->GetLocationInfo();
else if ( expr_location )
loc2 = expr_location;
zeek::reporter->PushLocation(GetLocationInfo(), loc2);
reporter->PushLocation(GetLocationInfo(), loc2);
}
void Obj::PinPoint(zeek::ODesc* d, const Obj* obj2, bool pinpoint_only) const
void Obj::PinPoint(ODesc* d, const Obj* obj2, bool pinpoint_only) const
{
d->Add(" (");
Describe(d);
@ -195,15 +195,15 @@ void Obj::PinPoint(zeek::ODesc* d, const Obj* obj2, bool pinpoint_only) const
void Obj::Print() const
{
static zeek::File fstderr(stderr);
zeek::ODesc d(DESC_READABLE, &fstderr);
static File fstderr(stderr);
ODesc d(DESC_READABLE, &fstderr);
Describe(&d);
d.Add("\n");
}
void bad_ref(int type)
{
zeek::reporter->InternalError("bad reference count [%d]", type);
reporter->InternalError("bad reference count [%d]", type);
abort();
}