mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
The remaining nulls
This commit is contained in:
parent
41c3256faa
commit
0a47588d0b
80 changed files with 565 additions and 565 deletions
20
src/Anon.cc
20
src/Anon.cc
|
@ -12,7 +12,7 @@
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
|
|
||||||
|
|
||||||
AnonymizeIPAddr* ip_anonymizer[NUM_ADDR_ANONYMIZATION_METHODS] = {0};
|
AnonymizeIPAddr* ip_anonymizer[NUM_ADDR_ANONYMIZATION_METHODS] = {nullptr};
|
||||||
|
|
||||||
static uint32_t rand32()
|
static uint32_t rand32()
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ AnonymizeIPAddr_A50::~AnonymizeIPAddr_A50()
|
||||||
|
|
||||||
void AnonymizeIPAddr_A50::init()
|
void AnonymizeIPAddr_A50::init()
|
||||||
{
|
{
|
||||||
root = next_free_node = 0;
|
root = next_free_node = nullptr;
|
||||||
|
|
||||||
// Prepare special nodes for 0.0.0.0 and 255.255.255.255.
|
// Prepare special nodes for 0.0.0.0 and 255.255.255.255.
|
||||||
memset(&special_nodes[0], 0, sizeof(special_nodes));
|
memset(&special_nodes[0], 0, sizeof(special_nodes));
|
||||||
|
@ -222,7 +222,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::new_node_block()
|
||||||
for ( int i = 1; i < block_size - 1; ++i )
|
for ( int i = 1; i < block_size - 1; ++i )
|
||||||
block[i].child[0] = &block[i+1];
|
block[i].child[0] = &block[i+1];
|
||||||
|
|
||||||
block[block_size - 1].child[0] = 0;
|
block[block_size - 1].child[0] = nullptr;
|
||||||
next_free_node = &block[1];
|
next_free_node = &block[1];
|
||||||
|
|
||||||
return &block[0];
|
return &block[0];
|
||||||
|
@ -276,12 +276,12 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::make_peer(ipaddr32_t a, Node* n)
|
||||||
Node* down[2];
|
Node* down[2];
|
||||||
|
|
||||||
if ( ! (down[0] = new_node()) )
|
if ( ! (down[0] = new_node()) )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( ! (down[1] = new_node()) )
|
if ( ! (down[1] = new_node()) )
|
||||||
{
|
{
|
||||||
free_node(down[0]);
|
free_node(down[0]);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// swivel is first bit 'a' and 'old->input' differ.
|
// swivel is first bit 'a' and 'old->input' differ.
|
||||||
|
@ -292,7 +292,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::make_peer(ipaddr32_t a, Node* n)
|
||||||
|
|
||||||
down[bitvalue]->input = a;
|
down[bitvalue]->input = a;
|
||||||
down[bitvalue]->output = make_output(n->output, swivel);
|
down[bitvalue]->output = make_output(n->output, swivel);
|
||||||
down[bitvalue]->child[0] = down[bitvalue]->child[1] = 0;
|
down[bitvalue]->child[0] = down[bitvalue]->child[1] = nullptr;
|
||||||
|
|
||||||
*down[1 - bitvalue] = *n; // copy orig node down one level
|
*down[1 - bitvalue] = *n; // copy orig node down one level
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::find_node(ipaddr32_t a)
|
||||||
root = new_node();
|
root = new_node();
|
||||||
root->input = a;
|
root->input = a;
|
||||||
root->output = rand32();
|
root->output = rand32();
|
||||||
root->child[0] = root->child[1] = 0;
|
root->child[0] = root->child[1] = nullptr;
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
@ -351,12 +351,12 @@ AnonymizeIPAddr_A50::Node* AnonymizeIPAddr_A50::find_node(ipaddr32_t a)
|
||||||
}
|
}
|
||||||
|
|
||||||
reporter->InternalError("out of memory!");
|
reporter->InternalError("out of memory!");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_ip_addr_anonymizers()
|
void init_ip_addr_anonymizers()
|
||||||
{
|
{
|
||||||
ip_anonymizer[KEEP_ORIG_ADDR] = 0;
|
ip_anonymizer[KEEP_ORIG_ADDR] = nullptr;
|
||||||
ip_anonymizer[SEQUENTIALLY_NUMBERED] = new AnonymizeIPAddr_Seq();
|
ip_anonymizer[SEQUENTIALLY_NUMBERED] = new AnonymizeIPAddr_Seq();
|
||||||
ip_anonymizer[RANDOM_MD5] = new AnonymizeIPAddr_RandomMD5();
|
ip_anonymizer[RANDOM_MD5] = new AnonymizeIPAddr_RandomMD5();
|
||||||
ip_anonymizer[PREFIX_PRESERVING_A50] = new AnonymizeIPAddr_A50();
|
ip_anonymizer[PREFIX_PRESERVING_A50] = new AnonymizeIPAddr_A50();
|
||||||
|
@ -365,7 +365,7 @@ void init_ip_addr_anonymizers()
|
||||||
|
|
||||||
ipaddr32_t anonymize_ip(ipaddr32_t ip, enum ip_addr_anonymization_class_t cl)
|
ipaddr32_t anonymize_ip(ipaddr32_t ip, enum ip_addr_anonymization_class_t cl)
|
||||||
{
|
{
|
||||||
TableVal* preserve_addr = 0;
|
TableVal* preserve_addr = nullptr;
|
||||||
AddrVal addr(ip);
|
AddrVal addr(ip);
|
||||||
|
|
||||||
int method = -1;
|
int method = -1;
|
||||||
|
|
|
@ -197,7 +197,7 @@ void Attributes::AddAttrs(Attributes* a)
|
||||||
Attr* Attributes::FindAttr(attr_tag t) const
|
Attr* Attributes::FindAttr(attr_tag t) const
|
||||||
{
|
{
|
||||||
if ( ! attrs )
|
if ( ! attrs )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
for ( const auto& a : *attrs )
|
for ( const auto& a : *attrs )
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,7 @@ Attr* Attributes::FindAttr(attr_tag t) const
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Attributes::RemoveAttr(attr_tag t)
|
void Attributes::RemoveAttr(attr_tag t)
|
||||||
|
|
|
@ -55,7 +55,7 @@ int* Base64Converter::InitBase64Table(const string& alphabet)
|
||||||
if ( alphabet == default_alphabet && default_table_initialized )
|
if ( alphabet == default_alphabet && default_table_initialized )
|
||||||
return default_base64_table;
|
return default_base64_table;
|
||||||
|
|
||||||
int* base64_table = 0;
|
int* base64_table = nullptr;
|
||||||
|
|
||||||
if ( alphabet == default_alphabet )
|
if ( alphabet == default_alphabet )
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ Base64Converter::Base64Converter(Connection* arg_conn, const string& arg_alphabe
|
||||||
alphabet = default_alphabet;
|
alphabet = default_alphabet;
|
||||||
}
|
}
|
||||||
|
|
||||||
base64_table = 0;
|
base64_table = nullptr;
|
||||||
base64_group_next = 0;
|
base64_group_next = 0;
|
||||||
base64_padding = base64_after_padding = 0;
|
base64_padding = base64_after_padding = 0;
|
||||||
errored = 0;
|
errored = 0;
|
||||||
|
@ -234,7 +234,7 @@ BroString* decode_base64(const BroString* s, const BroString* a, Connection* con
|
||||||
{
|
{
|
||||||
reporter->Error("base64 decoding alphabet is not 64 characters: %s",
|
reporter->Error("base64 decoding alphabet is not 64 characters: %s",
|
||||||
a->CheckString());
|
a->CheckString());
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int buf_len = int((s->Len() + 3) / 4) * 3 + 1;
|
int buf_len = int((s->Len() + 3) / 4) * 3 + 1;
|
||||||
|
@ -259,7 +259,7 @@ BroString* decode_base64(const BroString* s, const BroString* a, Connection* con
|
||||||
|
|
||||||
err:
|
err:
|
||||||
delete [] rbuf;
|
delete [] rbuf;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BroString* encode_base64(const BroString* s, const BroString* a, Connection* conn)
|
BroString* encode_base64(const BroString* s, const BroString* a, Connection* conn)
|
||||||
|
@ -268,10 +268,10 @@ BroString* encode_base64(const BroString* s, const BroString* a, Connection* con
|
||||||
{
|
{
|
||||||
reporter->Error("base64 alphabet is not 64 characters: %s",
|
reporter->Error("base64 alphabet is not 64 characters: %s",
|
||||||
a->CheckString());
|
a->CheckString());
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* outbuf = 0;
|
char* outbuf = nullptr;
|
||||||
int outlen = 0;
|
int outlen = 0;
|
||||||
Base64Converter enc(conn, a ? a->CheckString() : "");
|
Base64Converter enc(conn, a ? a->CheckString() : "");
|
||||||
enc.Encode(s->Len(), (const unsigned char*) s->Bytes(), &outlen, &outbuf);
|
enc.Encode(s->Len(), (const unsigned char*) s->Bytes(), &outlen, &outbuf);
|
||||||
|
|
|
@ -59,5 +59,5 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BroString* decode_base64(const BroString* s, const BroString* a = 0, Connection* conn = 0);
|
BroString* decode_base64(const BroString* s, const BroString* a = nullptr, Connection* conn = nullptr);
|
||||||
BroString* encode_base64(const BroString* s, const BroString* a = 0, Connection* conn = 0);
|
BroString* encode_base64(const BroString* s, const BroString* a = nullptr, Connection* conn = nullptr);
|
||||||
|
|
|
@ -284,7 +284,7 @@ BroString* BroString::GetSubstring(int start, int len) const
|
||||||
{
|
{
|
||||||
// This code used to live in zeek.bif's sub_bytes() routine.
|
// This code used to live in zeek.bif's sub_bytes() routine.
|
||||||
if ( start < 0 || start > n )
|
if ( start < 0 || start > n )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( len < 0 || len > n - start )
|
if ( len < 0 || len > n - start )
|
||||||
len = n - start;
|
len = n - start;
|
||||||
|
@ -302,7 +302,7 @@ BroString::Vec* BroString::Split(const BroString::IdxVec& indices) const
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if ( indices.empty() )
|
if ( indices.empty() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
// Copy input, ensuring space for "0":
|
// Copy input, ensuring space for "0":
|
||||||
IdxVec idx(1 + indices.size());
|
IdxVec idx(1 + indices.size());
|
||||||
|
@ -343,7 +343,7 @@ VectorVal* BroString:: VecToPolicy(Vec* vec)
|
||||||
VectorVal* result =
|
VectorVal* result =
|
||||||
new VectorVal(internal_type("string_vec")->AsVectorType());
|
new VectorVal(internal_type("string_vec")->AsVectorType());
|
||||||
if ( ! result )
|
if ( ! result )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < vec->size(); ++i )
|
for ( unsigned int i = 0; i < vec->size(); ++i )
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
//
|
//
|
||||||
// Note that you need to delete[] the resulting string.
|
// Note that you need to delete[] the resulting string.
|
||||||
//
|
//
|
||||||
char* Render(int format = EXPANDED_STRING, int* len = 0) const;
|
char* Render(int format = EXPANDED_STRING, int* len = nullptr) const;
|
||||||
|
|
||||||
// Similar to the above, but useful for output streams.
|
// Similar to the above, but useful for output streams.
|
||||||
// Also more useful for debugging purposes since no deallocation
|
// Also more useful for debugging purposes since no deallocation
|
||||||
|
|
|
@ -76,7 +76,7 @@ bool Brofiler::ReadStats()
|
||||||
|
|
||||||
pair<string, string> location_desc(std::move(location), std::move(desc));
|
pair<string, string> location_desc(std::move(location), std::move(desc));
|
||||||
uint64_t count;
|
uint64_t count;
|
||||||
atoi_n(cnt.size(), cnt.c_str(), 0, 10, count);
|
atoi_n(cnt.size(), cnt.c_str(), nullptr, 10, count);
|
||||||
usage_map.emplace(std::move(location_desc), count);
|
usage_map.emplace(std::move(location_desc), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,19 +47,19 @@ CompositeHash::CompositeHash(IntrusivePtr<TypeList> composite_type)
|
||||||
// via the singleton later.
|
// via the singleton later.
|
||||||
singleton_tag = (*type->Types())[0]->InternalType();
|
singleton_tag = (*type->Types())[0]->InternalType();
|
||||||
size = 0;
|
size = 0;
|
||||||
key = 0;
|
key = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = ComputeKeySize(0, true, true);
|
size = ComputeKeySize(nullptr, true, true);
|
||||||
|
|
||||||
if ( size > 0 )
|
if ( size > 0 )
|
||||||
// Fixed size. Make sure what we get is fully aligned.
|
// Fixed size. Make sure what we get is fully aligned.
|
||||||
key = reinterpret_cast<char*>
|
key = reinterpret_cast<char*>
|
||||||
(new double[size/sizeof(double) + 1]);
|
(new double[size/sizeof(double) + 1]);
|
||||||
else
|
else
|
||||||
key = 0;
|
key = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ CompositeHash::~CompositeHash()
|
||||||
char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
BroType* bt, Val* v, bool optional) const
|
BroType* bt, Val* v, bool optional) const
|
||||||
{
|
{
|
||||||
char* kp1 = 0;
|
char* kp1 = nullptr;
|
||||||
InternalTypeTag t = bt->InternalType();
|
InternalTypeTag t = bt->InternalType();
|
||||||
|
|
||||||
if ( optional )
|
if ( optional )
|
||||||
|
@ -90,7 +90,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
{
|
{
|
||||||
InternalTypeTag vt = v->Type()->InternalType();
|
InternalTypeTag vt = v->Type()->InternalType();
|
||||||
if ( vt != t )
|
if ( vt != t )
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( t ) {
|
switch ( t ) {
|
||||||
|
@ -186,12 +186,12 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
bool optional = (a && a->FindAttr(ATTR_OPTIONAL));
|
bool optional = (a && a->FindAttr(ATTR_OPTIONAL));
|
||||||
|
|
||||||
if ( ! (rv_i || optional) )
|
if ( ! (rv_i || optional) )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( ! (kp = SingleValHash(type_check, kp,
|
if ( ! (kp = SingleValHash(type_check, kp,
|
||||||
rt->FieldType(i),
|
rt->FieldType(i),
|
||||||
rv_i, optional)) )
|
rv_i, optional)) )
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
kp1 = kp;
|
kp1 = kp;
|
||||||
|
@ -242,7 +242,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
|
|
||||||
if ( ! (kp1 = SingleValHash(type_check, kp1, key->Type(), key,
|
if ( ! (kp1 = SingleValHash(type_check, kp1, key->Type(), key,
|
||||||
false)) )
|
false)) )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( ! v->Type()->IsSet() )
|
if ( ! v->Type()->IsSet() )
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
|
|
||||||
if ( ! (kp1 = SingleValHash(type_check, kp1, val->Type(),
|
if ( ! (kp1 = SingleValHash(type_check, kp1, val->Type(),
|
||||||
val.get(), false)) )
|
val.get(), false)) )
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
{
|
{
|
||||||
if ( ! (kp1 = SingleValHash(type_check, kp1,
|
if ( ! (kp1 = SingleValHash(type_check, kp1,
|
||||||
vt->YieldType(), val, false)) )
|
vt->YieldType(), val, false)) )
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
Val* v = lv->Index(i);
|
Val* v = lv->Index(i);
|
||||||
if ( ! (kp1 = SingleValHash(type_check, kp1, v->Type(), v,
|
if ( ! (kp1 = SingleValHash(type_check, kp1, v->Type(), v,
|
||||||
false)) )
|
false)) )
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -303,7 +303,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
reporter->InternalError("bad index type in CompositeHash::SingleValHash");
|
reporter->InternalError("bad index type in CompositeHash::SingleValHash");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ char* CompositeHash::SingleValHash(bool type_check, char* kp0,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_INTERNAL_ERROR:
|
case TYPE_INTERNAL_ERROR:
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return kp1;
|
return kp1;
|
||||||
|
@ -361,7 +361,7 @@ HashKey* CompositeHash::ComputeHash(const Val* v, bool type_check) const
|
||||||
{
|
{
|
||||||
int sz = ComputeKeySize(v, type_check, false);
|
int sz = ComputeKeySize(v, type_check, false);
|
||||||
if ( sz == 0 )
|
if ( sz == 0 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
k = reinterpret_cast<char*>(new double[sz/sizeof(double) + 1]);
|
k = reinterpret_cast<char*>(new double[sz/sizeof(double) + 1]);
|
||||||
type_check = false; // no need to type-check again.
|
type_check = false; // no need to type-check again.
|
||||||
|
@ -370,18 +370,18 @@ HashKey* CompositeHash::ComputeHash(const Val* v, bool type_check) const
|
||||||
const type_list* tl = type->Types();
|
const type_list* tl = type->Types();
|
||||||
|
|
||||||
if ( type_check && v->Type()->Tag() != TYPE_LIST )
|
if ( type_check && v->Type()->Tag() != TYPE_LIST )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
const val_list* vl = v->AsListVal()->Vals();
|
const val_list* vl = v->AsListVal()->Vals();
|
||||||
if ( type_check && vl->length() != tl->length() )
|
if ( type_check && vl->length() != tl->length() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
char* kp = k;
|
char* kp = k;
|
||||||
loop_over_list(*tl, i)
|
loop_over_list(*tl, i)
|
||||||
{
|
{
|
||||||
kp = SingleValHash(type_check, kp, (*tl)[i], (*vl)[i], false);
|
kp = SingleValHash(type_check, kp, (*tl)[i], (*vl)[i], false);
|
||||||
if ( ! kp )
|
if ( ! kp )
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HashKey((k == key), (void*) k, kp - k);
|
return new HashKey((k == key), (void*) k, kp - k);
|
||||||
|
@ -393,13 +393,13 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, bool type_check) cons
|
||||||
{
|
{
|
||||||
const val_list* vl = v->AsListVal()->Vals();
|
const val_list* vl = v->AsListVal()->Vals();
|
||||||
if ( type_check && vl->length() != 1 )
|
if ( type_check && vl->length() != 1 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
v = (*vl)[0];
|
v = (*vl)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type_check && v->Type()->InternalType() != singleton_tag )
|
if ( type_check && v->Type()->InternalType() != singleton_tag )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
switch ( singleton_tag ) {
|
switch ( singleton_tag ) {
|
||||||
case TYPE_INTERNAL_INT:
|
case TYPE_INTERNAL_INT:
|
||||||
|
@ -434,17 +434,17 @@ HashKey* CompositeHash::ComputeSingletonHash(const Val* v, bool type_check) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
reporter->InternalError("bad index type in CompositeHash::ComputeSingletonHash");
|
reporter->InternalError("bad index type in CompositeHash::ComputeSingletonHash");
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
case TYPE_INTERNAL_STRING:
|
case TYPE_INTERNAL_STRING:
|
||||||
return new HashKey(v->AsString());
|
return new HashKey(v->AsString());
|
||||||
|
|
||||||
case TYPE_INTERNAL_ERROR:
|
case TYPE_INTERNAL_ERROR:
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad internal type in CompositeHash::ComputeSingletonHash");
|
reporter->InternalError("bad internal type in CompositeHash::ComputeSingletonHash");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
||||||
|
|
||||||
case TYPE_RECORD:
|
case TYPE_RECORD:
|
||||||
{
|
{
|
||||||
const RecordVal* rv = v ? v->AsRecordVal() : 0;
|
const RecordVal* rv = v ? v->AsRecordVal() : nullptr;
|
||||||
RecordType* rt = bt->AsRecordType();
|
RecordType* rt = bt->AsRecordType();
|
||||||
int num_fields = rt->NumFields();
|
int num_fields = rt->NumFields();
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
||||||
bool optional = (a && a->FindAttr(ATTR_OPTIONAL));
|
bool optional = (a && a->FindAttr(ATTR_OPTIONAL));
|
||||||
|
|
||||||
sz = SingleTypeKeySize(rt->FieldType(i),
|
sz = SingleTypeKeySize(rt->FieldType(i),
|
||||||
rv ? rv->Lookup(i) : 0,
|
rv ? rv->Lookup(i) : nullptr,
|
||||||
type_check, sz, optional,
|
type_check, sz, optional,
|
||||||
calc_static_size);
|
calc_static_size);
|
||||||
if ( ! sz )
|
if ( ! sz )
|
||||||
|
@ -632,7 +632,7 @@ int CompositeHash::SingleTypeKeySize(BroType* bt, const Val* v,
|
||||||
int CompositeHash::ComputeKeySize(const Val* v, bool type_check, bool calc_static_size) const
|
int CompositeHash::ComputeKeySize(const Val* v, bool type_check, bool calc_static_size) const
|
||||||
{
|
{
|
||||||
const type_list* tl = type->Types();
|
const type_list* tl = type->Types();
|
||||||
const val_list* vl = 0;
|
const val_list* vl = nullptr;
|
||||||
if ( v )
|
if ( v )
|
||||||
{
|
{
|
||||||
if ( type_check && v->Type()->Tag() != TYPE_LIST )
|
if ( type_check && v->Type()->Tag() != TYPE_LIST )
|
||||||
|
@ -646,7 +646,7 @@ int CompositeHash::ComputeKeySize(const Val* v, bool type_check, bool calc_stati
|
||||||
int sz = 0;
|
int sz = 0;
|
||||||
loop_over_list(*tl, i)
|
loop_over_list(*tl, i)
|
||||||
{
|
{
|
||||||
sz = SingleTypeKeySize((*tl)[i], v ? v->AsListVal()->Index(i) : 0,
|
sz = SingleTypeKeySize((*tl)[i], v ? v->AsListVal()->Index(i) : nullptr,
|
||||||
type_check, sz, false, calc_static_size);
|
type_check, sz, false, calc_static_size);
|
||||||
if ( ! sz )
|
if ( ! sz )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -745,7 +745,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
||||||
|
|
||||||
TypeTag tag = t->Tag();
|
TypeTag tag = t->Tag();
|
||||||
InternalTypeTag it = t->InternalType();
|
InternalTypeTag it = t->InternalType();
|
||||||
const char* kp1 = 0;
|
const char* kp1 = nullptr;
|
||||||
|
|
||||||
if ( optional )
|
if ( optional )
|
||||||
{
|
{
|
||||||
|
|
20
src/Conn.cc
20
src/Conn.cc
|
@ -120,7 +120,7 @@ Connection::Connection(NetSessions* s, const ConnIDKey& k, double t, const ConnI
|
||||||
if ( arg_encap )
|
if ( arg_encap )
|
||||||
encapsulation = new EncapsulationStack(*arg_encap);
|
encapsulation = new EncapsulationStack(*arg_encap);
|
||||||
else
|
else
|
||||||
encapsulation = 0;
|
encapsulation = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection::~Connection()
|
Connection::~Connection()
|
||||||
|
@ -132,7 +132,7 @@ Connection::~Connection()
|
||||||
|
|
||||||
if ( conn_val )
|
if ( conn_val )
|
||||||
{
|
{
|
||||||
conn_val->SetOrigin(0);
|
conn_val->SetOrigin(nullptr);
|
||||||
Unref(conn_val);
|
Unref(conn_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void Connection::CheckEncapsulation(const EncapsulationStack* arg_encap)
|
||||||
{
|
{
|
||||||
if ( *encapsulation != *arg_encap )
|
if ( *encapsulation != *arg_encap )
|
||||||
{
|
{
|
||||||
Event(tunnel_changed, 0, arg_encap->GetVectorVal());
|
Event(tunnel_changed, nullptr, arg_encap->GetVectorVal());
|
||||||
delete encapsulation;
|
delete encapsulation;
|
||||||
encapsulation = new EncapsulationStack(*arg_encap);
|
encapsulation = new EncapsulationStack(*arg_encap);
|
||||||
}
|
}
|
||||||
|
@ -157,14 +157,14 @@ void Connection::CheckEncapsulation(const EncapsulationStack* arg_encap)
|
||||||
else if ( encapsulation )
|
else if ( encapsulation )
|
||||||
{
|
{
|
||||||
EncapsulationStack empty;
|
EncapsulationStack empty;
|
||||||
Event(tunnel_changed, 0, empty.GetVectorVal());
|
Event(tunnel_changed, nullptr, empty.GetVectorVal());
|
||||||
delete encapsulation;
|
delete encapsulation;
|
||||||
encapsulation = nullptr;
|
encapsulation = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( arg_encap )
|
else if ( arg_encap )
|
||||||
{
|
{
|
||||||
Event(tunnel_changed, 0, arg_encap->GetVectorVal());
|
Event(tunnel_changed, nullptr, arg_encap->GetVectorVal());
|
||||||
encapsulation = new EncapsulationStack(*arg_encap);
|
encapsulation = new EncapsulationStack(*arg_encap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ void Connection::HistoryThresholdEvent(EventHandlerPtr e, bool is_orig,
|
||||||
void Connection::DeleteTimer(double /* t */)
|
void Connection::DeleteTimer(double /* t */)
|
||||||
{
|
{
|
||||||
if ( is_active )
|
if ( is_active )
|
||||||
Event(connection_timeout, 0);
|
Event(connection_timeout, nullptr);
|
||||||
|
|
||||||
sessions->Remove(this);
|
sessions->Remove(this);
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ void Connection::InactivityTimer(double t)
|
||||||
{
|
{
|
||||||
if ( last_time + inactivity_timeout <= t )
|
if ( last_time + inactivity_timeout <= t )
|
||||||
{
|
{
|
||||||
Event(connection_timeout, 0);
|
Event(connection_timeout, nullptr);
|
||||||
sessions->Remove(this);
|
sessions->Remove(this);
|
||||||
++killed_by_inactivity;
|
++killed_by_inactivity;
|
||||||
}
|
}
|
||||||
|
@ -402,12 +402,12 @@ RecordVal* Connection::BuildConnVal()
|
||||||
|
|
||||||
analyzer::Analyzer* Connection::FindAnalyzer(analyzer::ID id)
|
analyzer::Analyzer* Connection::FindAnalyzer(analyzer::ID id)
|
||||||
{
|
{
|
||||||
return root_analyzer ? root_analyzer->FindChild(id) : 0;
|
return root_analyzer ? root_analyzer->FindChild(id) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
analyzer::Analyzer* Connection::FindAnalyzer(const analyzer::Tag& tag)
|
analyzer::Analyzer* Connection::FindAnalyzer(const analyzer::Tag& tag)
|
||||||
{
|
{
|
||||||
return root_analyzer ? root_analyzer->FindChild(tag) : 0;
|
return root_analyzer ? root_analyzer->FindChild(tag) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
analyzer::Analyzer* Connection::FindAnalyzer(const char* name)
|
analyzer::Analyzer* Connection::FindAnalyzer(const char* name)
|
||||||
|
@ -696,7 +696,7 @@ void Connection::CheckFlowLabel(bool is_orig, uint32_t flow_label)
|
||||||
if ( connection_flow_label_changed &&
|
if ( connection_flow_label_changed &&
|
||||||
(is_orig ? saw_first_orig_packet : saw_first_resp_packet) )
|
(is_orig ? saw_first_orig_packet : saw_first_resp_packet) )
|
||||||
{
|
{
|
||||||
EnqueueEvent(connection_flow_label_changed, 0,
|
EnqueueEvent(connection_flow_label_changed, nullptr,
|
||||||
IntrusivePtr{AdoptRef{}, BuildConnVal()},
|
IntrusivePtr{AdoptRef{}, BuildConnVal()},
|
||||||
IntrusivePtr{AdoptRef{}, val_mgr->GetBool(is_orig)},
|
IntrusivePtr{AdoptRef{}, val_mgr->GetBool(is_orig)},
|
||||||
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(my_flow_label)},
|
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(my_flow_label)},
|
||||||
|
|
|
@ -180,13 +180,13 @@ public:
|
||||||
// given that event's first argument will be it, and it's second will be
|
// given that event's first argument will be it, and it's second will be
|
||||||
// the connection value. If 'name' is null, then the event's first
|
// the connection value. If 'name' is null, then the event's first
|
||||||
// argument is the connection value.
|
// argument is the connection value.
|
||||||
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, const char* name = 0);
|
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, const char* name = nullptr);
|
||||||
|
|
||||||
// If a handler exists for 'f', an event will be generated. In any case,
|
// If a handler exists for 'f', an event will be generated. In any case,
|
||||||
// 'v1' and 'v2' reference counts get decremented. The event's first
|
// 'v1' and 'v2' reference counts get decremented. The event's first
|
||||||
// argument is the connection value, second argument is 'v1', and if 'v2'
|
// argument is the connection value, second argument is 'v1', and if 'v2'
|
||||||
// is given that will be it's third argument.
|
// is given that will be it's third argument.
|
||||||
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, Val* v1, Val* v2 = 0);
|
void Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, Val* v1, Val* v2 = nullptr);
|
||||||
|
|
||||||
// If a handler exists for 'f', an event will be generated. In any case,
|
// If a handler exists for 'f', an event will be generated. In any case,
|
||||||
// reference count for each element in the 'vl' list are decremented. The
|
// reference count for each element in the 'vl' list are decremented. The
|
||||||
|
|
10
src/DFA.cc
10
src/DFA.cc
|
@ -17,7 +17,7 @@ DFA_State::DFA_State(int arg_state_num, const EquivClass* ec,
|
||||||
num_sym = ec->NumClasses();
|
num_sym = ec->NumClasses();
|
||||||
nfa_states = arg_nfa_states;
|
nfa_states = arg_nfa_states;
|
||||||
accept = arg_accept;
|
accept = arg_accept;
|
||||||
mark = 0;
|
mark = nullptr;
|
||||||
|
|
||||||
SymPartition(ec);
|
SymPartition(ec);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ DFA_State* DFA_State::ComputeXtion(int sym, DFA_Machine* machine)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete ns;
|
delete ns;
|
||||||
next_d = 0; // Jam
|
next_d = nullptr; // Jam
|
||||||
}
|
}
|
||||||
|
|
||||||
AddXtion(equiv_sym, next_d);
|
AddXtion(equiv_sym, next_d);
|
||||||
|
@ -182,7 +182,7 @@ void DFA_State::ClearMarks()
|
||||||
{
|
{
|
||||||
if ( mark )
|
if ( mark )
|
||||||
{
|
{
|
||||||
SetMark(0);
|
SetMark(nullptr);
|
||||||
|
|
||||||
for ( int i = 0; i < num_sym; ++i )
|
for ( int i = 0; i < num_sym; ++i )
|
||||||
{
|
{
|
||||||
|
@ -395,7 +395,7 @@ DFA_Machine::DFA_Machine(NFA_Machine* n, EquivClass* arg_ec)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start_state = 0; // Jam
|
start_state = nullptr; // Jam
|
||||||
delete ns;
|
delete ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ bool DFA_Machine::StateSetToDFA_State(NFA_state_list* state_set,
|
||||||
if ( accept->empty() )
|
if ( accept->empty() )
|
||||||
{
|
{
|
||||||
delete accept;
|
delete accept;
|
||||||
accept = 0;
|
accept = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DFA_State* ds = new DFA_State(state_count++, ec, state_set, accept);
|
DFA_State* ds = new DFA_State(state_count++, ec, state_set, accept);
|
||||||
|
|
|
@ -194,7 +194,7 @@ DNS_Mapping::DNS_Mapping(const IPAddr& addr, struct hostent* h, uint32_t ttl)
|
||||||
{
|
{
|
||||||
Init(h);
|
Init(h);
|
||||||
req_addr = addr;
|
req_addr = addr;
|
||||||
req_host = 0;
|
req_host = nullptr;
|
||||||
req_ttl = ttl;
|
req_ttl = ttl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ DNS_Mapping::DNS_Mapping(FILE* f)
|
||||||
Clear();
|
Clear();
|
||||||
init_failed = true;
|
init_failed = true;
|
||||||
|
|
||||||
req_host = 0;
|
req_host = nullptr;
|
||||||
req_ttl = 0;
|
req_ttl = 0;
|
||||||
creation_time = 0;
|
creation_time = 0;
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ DNS_Mapping::DNS_Mapping(FILE* f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addrs = 0;
|
addrs = nullptr;
|
||||||
|
|
||||||
init_failed = false;
|
init_failed = false;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ IntrusivePtr<TableVal> DNS_Mapping::AddrsSet() {
|
||||||
IntrusivePtr<StringVal> DNS_Mapping::Host()
|
IntrusivePtr<StringVal> DNS_Mapping::Host()
|
||||||
{
|
{
|
||||||
if ( failed || num_names == 0 || ! names[0] )
|
if ( failed || num_names == 0 || ! names[0] )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( ! host_val )
|
if ( ! host_val )
|
||||||
host_val = make_intrusive<StringVal>(names[0]);
|
host_val = make_intrusive<StringVal>(names[0]);
|
||||||
|
@ -315,8 +315,8 @@ void DNS_Mapping::Init(struct hostent* h)
|
||||||
no_mapping = false;
|
no_mapping = false;
|
||||||
init_failed = false;
|
init_failed = false;
|
||||||
creation_time = current_time();
|
creation_time = current_time();
|
||||||
host_val = 0;
|
host_val = nullptr;
|
||||||
addrs_val = 0;
|
addrs_val = nullptr;
|
||||||
|
|
||||||
if ( ! h )
|
if ( ! h )
|
||||||
{
|
{
|
||||||
|
@ -327,7 +327,7 @@ void DNS_Mapping::Init(struct hostent* h)
|
||||||
map_type = h->h_addrtype;
|
map_type = h->h_addrtype;
|
||||||
num_names = 1; // for now, just use official name
|
num_names = 1; // for now, just use official name
|
||||||
names = new char*[num_names];
|
names = new char*[num_names];
|
||||||
names[0] = h->h_name ? copy_string(h->h_name) : 0;
|
names[0] = h->h_name ? copy_string(h->h_name) : nullptr;
|
||||||
|
|
||||||
for ( num_addrs = 0; h->h_addr_list[num_addrs]; ++num_addrs )
|
for ( num_addrs = 0; h->h_addr_list[num_addrs]; ++num_addrs )
|
||||||
;
|
;
|
||||||
|
@ -344,7 +344,7 @@ void DNS_Mapping::Init(struct hostent* h)
|
||||||
IPAddr::Network);
|
IPAddr::Network);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addrs = 0;
|
addrs = nullptr;
|
||||||
|
|
||||||
failed = false;
|
failed = false;
|
||||||
}
|
}
|
||||||
|
@ -352,10 +352,10 @@ void DNS_Mapping::Init(struct hostent* h)
|
||||||
void DNS_Mapping::Clear()
|
void DNS_Mapping::Clear()
|
||||||
{
|
{
|
||||||
num_names = num_addrs = 0;
|
num_names = num_addrs = 0;
|
||||||
names = 0;
|
names = nullptr;
|
||||||
addrs = 0;
|
addrs = nullptr;
|
||||||
host_val = 0;
|
host_val = nullptr;
|
||||||
addrs_val = 0;
|
addrs_val = nullptr;
|
||||||
no_mapping = false;
|
no_mapping = false;
|
||||||
map_type = 0;
|
map_type = 0;
|
||||||
failed = true;
|
failed = true;
|
||||||
|
@ -363,7 +363,7 @@ void DNS_Mapping::Clear()
|
||||||
|
|
||||||
void DNS_Mapping::Save(FILE* f) const
|
void DNS_Mapping::Save(FILE* f) const
|
||||||
{
|
{
|
||||||
fprintf(f, "%.0f %d %s %d %s %d %d %" PRIu32"\n", creation_time, req_host != 0,
|
fprintf(f, "%.0f %d %s %d %s %d %d %" PRIu32"\n", creation_time, req_host != nullptr,
|
||||||
req_host ? req_host : req_addr.AsString().c_str(),
|
req_host ? req_host : req_addr.AsString().c_str(),
|
||||||
failed, (names && names[0]) ? names[0] : "*",
|
failed, (names && names[0]) ? names[0] : "*",
|
||||||
map_type, num_addrs, req_ttl);
|
map_type, num_addrs, req_ttl);
|
||||||
|
@ -381,11 +381,11 @@ DNS_Mgr::DNS_Mgr(DNS_MgrMode arg_mode)
|
||||||
|
|
||||||
dns_mapping_valid = dns_mapping_unverified = dns_mapping_new_name =
|
dns_mapping_valid = dns_mapping_unverified = dns_mapping_new_name =
|
||||||
dns_mapping_lost_name = dns_mapping_name_changed =
|
dns_mapping_lost_name = dns_mapping_name_changed =
|
||||||
dns_mapping_altered = 0;
|
dns_mapping_altered = nullptr;
|
||||||
|
|
||||||
dm_rec = 0;
|
dm_rec = nullptr;
|
||||||
|
|
||||||
cache_name = dir = 0;
|
cache_name = dir = nullptr;
|
||||||
|
|
||||||
asyncs_pending = 0;
|
asyncs_pending = 0;
|
||||||
num_requests = 0;
|
num_requests = 0;
|
||||||
|
@ -540,7 +540,7 @@ IntrusivePtr<TableVal> DNS_Mgr::LookupHost(const char* name)
|
||||||
|
|
||||||
case DNS_FORCE:
|
case DNS_FORCE:
|
||||||
reporter->FatalError("can't find DNS entry for %s in cache", name);
|
reporter->FatalError("can't find DNS entry for %s in cache", name);
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
case DNS_DEFAULT:
|
case DNS_DEFAULT:
|
||||||
requests.push_back(new DNS_Mgr_Request(name, AF_INET, false));
|
requests.push_back(new DNS_Mgr_Request(name, AF_INET, false));
|
||||||
|
@ -550,7 +550,7 @@ IntrusivePtr<TableVal> DNS_Mgr::LookupHost(const char* name)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad mode in DNS_Mgr::LookupHost");
|
reporter->InternalError("bad mode in DNS_Mgr::LookupHost");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ IntrusivePtr<Val> DNS_Mgr::LookupAddr(const IPAddr& addr)
|
||||||
case DNS_FORCE:
|
case DNS_FORCE:
|
||||||
reporter->FatalError("can't find DNS entry for %s in cache",
|
reporter->FatalError("can't find DNS entry for %s in cache",
|
||||||
addr.AsString().c_str());
|
addr.AsString().c_str());
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
case DNS_DEFAULT:
|
case DNS_DEFAULT:
|
||||||
requests.push_back(new DNS_Mgr_Request(addr));
|
requests.push_back(new DNS_Mgr_Request(addr));
|
||||||
|
@ -594,7 +594,7 @@ IntrusivePtr<Val> DNS_Mgr::LookupAddr(const IPAddr& addr)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalError("bad mode in DNS_Mgr::LookupAddr");
|
reporter->InternalError("bad mode in DNS_Mgr::LookupAddr");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ void DNS_Mgr::Resolve()
|
||||||
DNS_Mgr_Request* dr = requests[i];
|
DNS_Mgr_Request* dr = requests[i];
|
||||||
if ( dr->RequestPending() )
|
if ( dr->RequestPending() )
|
||||||
{
|
{
|
||||||
AddResult(dr, 0);
|
AddResult(dr, nullptr);
|
||||||
dr->RequestDone();
|
dr->RequestDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -748,7 +748,7 @@ IntrusivePtr<Val> DNS_Mgr::BuildMappingVal(DNS_Mapping* dm)
|
||||||
|
|
||||||
void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
|
void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
|
||||||
{
|
{
|
||||||
struct hostent* h = (r && r->host_errno == 0) ? r->hostent : 0;
|
struct hostent* h = (r && r->host_errno == 0) ? r->hostent : nullptr;
|
||||||
u_int32_t ttl = (r && r->host_errno == 0) ? r->ttl : 0;
|
u_int32_t ttl = (r && r->host_errno == 0) ? r->ttl : 0;
|
||||||
|
|
||||||
DNS_Mapping* new_dm;
|
DNS_Mapping* new_dm;
|
||||||
|
@ -758,7 +758,7 @@ void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
|
||||||
if ( dr->ReqHost() )
|
if ( dr->ReqHost() )
|
||||||
{
|
{
|
||||||
new_dm = new DNS_Mapping(dr->ReqHost(), h, ttl);
|
new_dm = new DNS_Mapping(dr->ReqHost(), h, ttl);
|
||||||
prev_dm = 0;
|
prev_dm = nullptr;
|
||||||
|
|
||||||
if ( dr->ReqIsTxt() )
|
if ( dr->ReqIsTxt() )
|
||||||
{
|
{
|
||||||
|
@ -784,10 +784,10 @@ void DNS_Mgr::AddResult(DNS_Mgr_Request* dr, struct nb_dns_result* r)
|
||||||
if ( it == host_mappings.end() )
|
if ( it == host_mappings.end() )
|
||||||
{
|
{
|
||||||
host_mappings[dr->ReqHost()].first =
|
host_mappings[dr->ReqHost()].first =
|
||||||
new_dm->Type() == AF_INET ? new_dm : 0;
|
new_dm->Type() == AF_INET ? new_dm : nullptr;
|
||||||
|
|
||||||
host_mappings[dr->ReqHost()].second =
|
host_mappings[dr->ReqHost()].second =
|
||||||
new_dm->Type() == AF_INET ? 0 : new_dm;
|
new_dm->Type() == AF_INET ? nullptr : new_dm;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -980,7 +980,7 @@ const char* DNS_Mgr::LookupAddrInCache(const IPAddr& addr)
|
||||||
AddrMap::iterator it = addr_mappings.find(addr);
|
AddrMap::iterator it = addr_mappings.find(addr);
|
||||||
|
|
||||||
if ( it == addr_mappings.end() )
|
if ( it == addr_mappings.end() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
DNS_Mapping* d = it->second;
|
DNS_Mapping* d = it->second;
|
||||||
|
|
||||||
|
@ -988,7 +988,7 @@ const char* DNS_Mgr::LookupAddrInCache(const IPAddr& addr)
|
||||||
{
|
{
|
||||||
addr_mappings.erase(it);
|
addr_mappings.erase(it);
|
||||||
delete d;
|
delete d;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The escapes in the following strings are to avoid having it
|
// The escapes in the following strings are to avoid having it
|
||||||
|
@ -1002,21 +1002,21 @@ IntrusivePtr<TableVal> DNS_Mgr::LookupNameInCache(const string& name)
|
||||||
if ( it == host_mappings.end() )
|
if ( it == host_mappings.end() )
|
||||||
{
|
{
|
||||||
it = host_mappings.begin();
|
it = host_mappings.begin();
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DNS_Mapping* d4 = it->second.first;
|
DNS_Mapping* d4 = it->second.first;
|
||||||
DNS_Mapping* d6 = it->second.second;
|
DNS_Mapping* d6 = it->second.second;
|
||||||
|
|
||||||
if ( ! d4 || ! d4->names || ! d6 || ! d6->names )
|
if ( ! d4 || ! d4->names || ! d6 || ! d6->names )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( d4->Expired() || d6->Expired() )
|
if ( d4->Expired() || d6->Expired() )
|
||||||
{
|
{
|
||||||
host_mappings.erase(it);
|
host_mappings.erase(it);
|
||||||
delete d4;
|
delete d4;
|
||||||
delete d6;
|
delete d6;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto tv4 = d4->AddrsSet();
|
auto tv4 = d4->AddrsSet();
|
||||||
|
@ -1029,7 +1029,7 @@ const char* DNS_Mgr::LookupTextInCache(const string& name)
|
||||||
{
|
{
|
||||||
TextMap::iterator it = text_mappings.find(name);
|
TextMap::iterator it = text_mappings.find(name);
|
||||||
if ( it == text_mappings.end() )
|
if ( it == text_mappings.end() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
DNS_Mapping* d = it->second;
|
DNS_Mapping* d = it->second;
|
||||||
|
|
||||||
|
@ -1037,7 +1037,7 @@ const char* DNS_Mgr::LookupTextInCache(const string& name)
|
||||||
{
|
{
|
||||||
text_mappings.erase(it);
|
text_mappings.erase(it);
|
||||||
delete d;
|
delete d;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The escapes in the following strings are to avoid having it
|
// The escapes in the following strings are to avoid having it
|
||||||
|
@ -1077,7 +1077,7 @@ void DNS_Mgr::AsyncLookupAddr(const IPAddr& host, LookupCallback* callback)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncRequest* req = 0;
|
AsyncRequest* req = nullptr;
|
||||||
|
|
||||||
// Have we already a request waiting for this host?
|
// Have we already a request waiting for this host?
|
||||||
AsyncRequestAddrMap::iterator i = asyncs_addrs.find(host);
|
AsyncRequestAddrMap::iterator i = asyncs_addrs.find(host);
|
||||||
|
@ -1115,7 +1115,7 @@ void DNS_Mgr::AsyncLookupName(const string& name, LookupCallback* callback)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncRequest* req = 0;
|
AsyncRequest* req = nullptr;
|
||||||
|
|
||||||
// Have we already a request waiting for this host?
|
// Have we already a request waiting for this host?
|
||||||
AsyncRequestNameMap::iterator i = asyncs_names.find(name);
|
AsyncRequestNameMap::iterator i = asyncs_names.find(name);
|
||||||
|
@ -1154,7 +1154,7 @@ void DNS_Mgr::AsyncLookupNameText(const string& name, LookupCallback* callback)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncRequest* req = 0;
|
AsyncRequest* req = nullptr;
|
||||||
|
|
||||||
// Have we already a request waiting for this host?
|
// Have we already a request waiting for this host?
|
||||||
AsyncRequestTextMap::iterator i = asyncs_texts.find(name);
|
AsyncRequestTextMap::iterator i = asyncs_texts.find(name);
|
||||||
|
|
|
@ -49,13 +49,13 @@ DbgBreakpoint::DbgBreakpoint()
|
||||||
enabled = temporary = false;
|
enabled = temporary = false;
|
||||||
BPID = -1;
|
BPID = -1;
|
||||||
|
|
||||||
at_stmt = 0;
|
at_stmt = nullptr;
|
||||||
at_time = -1.0;
|
at_time = -1.0;
|
||||||
|
|
||||||
repeat_count = hit_count = 0;
|
repeat_count = hit_count = 0;
|
||||||
|
|
||||||
description[0] = 0;
|
description[0] = 0;
|
||||||
source_filename = 0;
|
source_filename = nullptr;
|
||||||
source_line = 0;
|
source_line = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
30
src/Debug.cc
30
src/Debug.cc
|
@ -55,7 +55,7 @@ DebuggerState::DebuggerState()
|
||||||
BreakFromSignal(false);
|
BreakFromSignal(false);
|
||||||
|
|
||||||
// ### Don't choose this arbitrary size! Extend Frame.
|
// ### Don't choose this arbitrary size! Extend Frame.
|
||||||
dbg_locals = new Frame(1024, /* func = */ 0, /* fn_args = */ 0);
|
dbg_locals = new Frame(1024, /* func = */ nullptr, /* fn_args = */ nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerState::~DebuggerState()
|
DebuggerState::~DebuggerState()
|
||||||
|
@ -107,7 +107,7 @@ FILE* TraceState::SetTraceFile(const char* filename)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to open trace file %s\n", filename);
|
fprintf(stderr, "Unable to open trace file %s\n", filename);
|
||||||
trace_file = 0;
|
trace_file = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return oldfile;
|
return oldfile;
|
||||||
|
@ -137,7 +137,7 @@ int TraceState::LogTrace(const char* fmt, ...)
|
||||||
|
|
||||||
const Stmt* stmt;
|
const Stmt* stmt;
|
||||||
Location loc;
|
Location loc;
|
||||||
loc.filename = 0;
|
loc.filename = nullptr;
|
||||||
|
|
||||||
if ( g_frame_stack.size() > 0 && g_frame_stack.back() )
|
if ( g_frame_stack.size() > 0 && g_frame_stack.back() )
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ void get_first_statement(Stmt* list, Stmt*& first, Location& loc)
|
||||||
{
|
{
|
||||||
if ( ! list )
|
if ( ! list )
|
||||||
{
|
{
|
||||||
first = 0;
|
first = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ static void parse_function_name(vector<ParseLocationRec>& result,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stmt* body = 0; // the particular body we care about; 0 = all
|
Stmt* body = nullptr; // the particular body we care about; 0 = all
|
||||||
|
|
||||||
if ( bodies.size() == 1 )
|
if ( bodies.size() == 1 )
|
||||||
body = bodies[0].stmts.get();
|
body = bodies[0].stmts.get();
|
||||||
|
@ -380,7 +380,7 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
StmtLocMapping* hit = 0;
|
StmtLocMapping* hit = nullptr;
|
||||||
for ( const auto entry : *(iter->second) )
|
for ( const auto entry : *(iter->second) )
|
||||||
{
|
{
|
||||||
plr.filename = entry->Loc().filename;
|
plr.filename = entry->Loc().filename;
|
||||||
|
@ -399,7 +399,7 @@ vector<ParseLocationRec> parse_location_string(const string& s)
|
||||||
if ( hit )
|
if ( hit )
|
||||||
plr.stmt = hit->Statement();
|
plr.stmt = hit->Statement();
|
||||||
else
|
else
|
||||||
plr.stmt = 0;
|
plr.stmt = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -730,7 +730,7 @@ static char* get_prompt(bool reset_counter = false)
|
||||||
string get_context_description(const Stmt* stmt, const Frame* frame)
|
string get_context_description(const Stmt* stmt, const Frame* frame)
|
||||||
{
|
{
|
||||||
ODesc d;
|
ODesc d;
|
||||||
const BroFunc* func = frame ? frame->GetFunction() : 0;
|
const BroFunc* func = frame ? frame->GetFunction() : nullptr;
|
||||||
|
|
||||||
if ( func )
|
if ( func )
|
||||||
func->DescribeDebug(&d, frame->GetFuncArgs());
|
func->DescribeDebug(&d, frame->GetFuncArgs());
|
||||||
|
@ -758,7 +758,7 @@ string get_context_description(const Stmt* stmt, const Frame* frame)
|
||||||
|
|
||||||
int dbg_handle_debug_input()
|
int dbg_handle_debug_input()
|
||||||
{
|
{
|
||||||
static char* input_line = 0;
|
static char* input_line = nullptr;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
if ( g_debugger_state.BreakFromSignal() )
|
if ( g_debugger_state.BreakFromSignal() )
|
||||||
|
@ -820,7 +820,7 @@ int dbg_handle_debug_input()
|
||||||
if ( input_line )
|
if ( input_line )
|
||||||
{
|
{
|
||||||
free(input_line); // this was malloc'ed
|
free(input_line); // this was malloc'ed
|
||||||
input_line = 0;
|
input_line = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -934,8 +934,8 @@ bool post_execute_stmt(Stmt* stmt, Frame* f, Val* result, stmt_flow_type* flow)
|
||||||
|
|
||||||
// Evaluates the given expression in the context of the currently selected
|
// Evaluates the given expression in the context of the currently selected
|
||||||
// frame. Returns the resulting value, or nil if none (or there was an error).
|
// frame. Returns the resulting value, or nil if none (or there was an error).
|
||||||
Expr* g_curr_debug_expr = 0;
|
Expr* g_curr_debug_expr = nullptr;
|
||||||
const char* g_curr_debug_error = 0;
|
const char* g_curr_debug_error = nullptr;
|
||||||
bool in_debug = false;
|
bool in_debug = false;
|
||||||
|
|
||||||
// ### fix this hardwired access to external variables etc.
|
// ### fix this hardwired access to external variables etc.
|
||||||
|
@ -993,7 +993,7 @@ IntrusivePtr<Val> dbg_eval_expr(const char* expr)
|
||||||
if ( g_curr_debug_expr )
|
if ( g_curr_debug_expr )
|
||||||
{
|
{
|
||||||
delete g_curr_debug_expr;
|
delete g_curr_debug_expr;
|
||||||
g_curr_debug_expr = 0;
|
g_curr_debug_expr = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1003,9 +1003,9 @@ IntrusivePtr<Val> dbg_eval_expr(const char* expr)
|
||||||
pop_scope();
|
pop_scope();
|
||||||
|
|
||||||
delete g_curr_debug_expr;
|
delete g_curr_debug_expr;
|
||||||
g_curr_debug_expr = 0;
|
g_curr_debug_expr = nullptr;
|
||||||
delete [] g_curr_debug_error;
|
delete [] g_curr_debug_error;
|
||||||
g_curr_debug_error = 0;
|
g_curr_debug_error = nullptr;
|
||||||
in_debug = false;
|
in_debug = false;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -149,7 +149,7 @@ bool post_execute_stmt(Stmt* stmt, Frame* f, Val* result, stmt_flow_type* flow);
|
||||||
// Returns 1 if successful, 0 otherwise.
|
// Returns 1 if successful, 0 otherwise.
|
||||||
// If cmdfile is non-nil, it contains the location of a file of commands
|
// If cmdfile is non-nil, it contains the location of a file of commands
|
||||||
// to be executed as debug commands.
|
// to be executed as debug commands.
|
||||||
int dbg_init_debugger(const char* cmdfile = 0);
|
int dbg_init_debugger(const char* cmdfile = nullptr);
|
||||||
int dbg_shutdown_debugger();
|
int dbg_shutdown_debugger();
|
||||||
|
|
||||||
// Returns 1 if successful, 0 otherwise.
|
// Returns 1 if successful, 0 otherwise.
|
||||||
|
|
|
@ -125,7 +125,7 @@ void choose_global_symbols_regex(const string& regex, vector<ID*>& choices,
|
||||||
PQueue<DebugCmdInfo> g_DebugCmdInfos;
|
PQueue<DebugCmdInfo> g_DebugCmdInfos;
|
||||||
|
|
||||||
DebugCmdInfo::DebugCmdInfo(const DebugCmdInfo& info)
|
DebugCmdInfo::DebugCmdInfo(const DebugCmdInfo& info)
|
||||||
: cmd(info.cmd), helpstring(0)
|
: cmd(info.cmd), helpstring(nullptr)
|
||||||
{
|
{
|
||||||
num_names = info.num_names;
|
num_names = info.num_names;
|
||||||
names = info.names;
|
names = info.names;
|
||||||
|
@ -153,7 +153,7 @@ const DebugCmdInfo* get_debug_cmd_info(DebugCmd cmd)
|
||||||
if ( (int) cmd < g_DebugCmdInfos.length() )
|
if ( (int) cmd < g_DebugCmdInfos.length() )
|
||||||
return g_DebugCmdInfos[(int) cmd];
|
return g_DebugCmdInfos[(int) cmd];
|
||||||
else
|
else
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int find_all_matching_cmds(const string& prefix, const char* array_of_matches[])
|
int find_all_matching_cmds(const string& prefix, const char* array_of_matches[])
|
||||||
|
@ -165,7 +165,7 @@ int find_all_matching_cmds(const string& prefix, const char* array_of_matches[])
|
||||||
|
|
||||||
for ( int i = 0; i < num_debug_cmds(); ++i )
|
for ( int i = 0; i < num_debug_cmds(); ++i )
|
||||||
{
|
{
|
||||||
array_of_matches[g_DebugCmdInfos[i]->Cmd()] = 0;
|
array_of_matches[g_DebugCmdInfos[i]->Cmd()] = nullptr;
|
||||||
|
|
||||||
for ( int j = 0; j < g_DebugCmdInfos[i]->NumNames(); ++j )
|
for ( int j = 0; j < g_DebugCmdInfos[i]->NumNames(); ++j )
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,7 @@ int find_all_matching_cmds(const string& prefix, const char* array_of_matches[])
|
||||||
if ( ! prefix.compare(curr_name) )
|
if ( ! prefix.compare(curr_name) )
|
||||||
{
|
{
|
||||||
for ( int k = 0; k < num_debug_cmds(); ++k )
|
for ( int k = 0; k < num_debug_cmds(); ++k )
|
||||||
array_of_matches[k] = 0;
|
array_of_matches[k] = nullptr;
|
||||||
|
|
||||||
array_of_matches[g_DebugCmdInfos[i]->Cmd()] = curr_name;
|
array_of_matches[g_DebugCmdInfos[i]->Cmd()] = curr_name;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -214,7 +214,7 @@ static int dbg_backtrace_internal(int start, int end)
|
||||||
for ( int i = start; i >= end; --i )
|
for ( int i = start; i >= end; --i )
|
||||||
{
|
{
|
||||||
const Frame* f = g_frame_stack[i];
|
const Frame* f = g_frame_stack[i];
|
||||||
const Stmt* stmt = f ? f->GetNextStmt() : 0;
|
const Stmt* stmt = f ? f->GetNextStmt() : nullptr;
|
||||||
|
|
||||||
string context = get_context_description(stmt, f);
|
string context = get_context_description(stmt, f);
|
||||||
debug_msg("#%d %s\n",
|
debug_msg("#%d %s\n",
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
bool resume_execution, const char* const helpstring,
|
bool resume_execution, const char* const helpstring,
|
||||||
bool repeatable);
|
bool repeatable);
|
||||||
|
|
||||||
DebugCmdInfo() : helpstring(0) {}
|
DebugCmdInfo() : helpstring(nullptr) {}
|
||||||
|
|
||||||
int Cmd() const { return cmd; }
|
int Cmd() const { return cmd; }
|
||||||
int NumNames() const { return num_names; }
|
int NumNames() const { return num_names; }
|
||||||
|
|
|
@ -26,7 +26,7 @@ DebugLogger::Stream DebugLogger::streams[NUM_DBGS] = {
|
||||||
DebugLogger::DebugLogger()
|
DebugLogger::DebugLogger()
|
||||||
{
|
{
|
||||||
verbose = false;
|
verbose = false;
|
||||||
file = 0;
|
file = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLogger::~DebugLogger()
|
DebugLogger::~DebugLogger()
|
||||||
|
|
|
@ -21,7 +21,7 @@ ODesc::ODesc(desc_type t, BroFile* arg_f)
|
||||||
style = STANDARD_STYLE;
|
style = STANDARD_STYLE;
|
||||||
f = arg_f;
|
f = arg_f;
|
||||||
|
|
||||||
if ( f == 0 )
|
if ( f == nullptr )
|
||||||
{
|
{
|
||||||
size = DEFAULT_SIZE;
|
size = DEFAULT_SIZE;
|
||||||
base = safe_malloc(size);
|
base = safe_malloc(size);
|
||||||
|
@ -31,7 +31,7 @@ ODesc::ODesc(desc_type t, BroFile* arg_f)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
offset = size = 0;
|
offset = size = 0;
|
||||||
base = 0;
|
base = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
indent_level = 0;
|
indent_level = 0;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class BroType;
|
||||||
|
|
||||||
class ODesc {
|
class ODesc {
|
||||||
public:
|
public:
|
||||||
explicit ODesc(desc_type t=DESC_READABLE, BroFile* f=0);
|
explicit ODesc(desc_type t=DESC_READABLE, BroFile* f=nullptr);
|
||||||
|
|
||||||
~ODesc();
|
~ODesc();
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public:
|
||||||
byte_vec TakeBytes()
|
byte_vec TakeBytes()
|
||||||
{
|
{
|
||||||
const void* t = base;
|
const void* t = base;
|
||||||
base = 0;
|
base = nullptr;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
// Don't clear offset, as we want to still support
|
// Don't clear offset, as we want to still support
|
||||||
|
|
30
src/Dict.cc
30
src/Dict.cc
|
@ -81,7 +81,7 @@ TEST_CASE("dict operation")
|
||||||
dict.Remove(key2);
|
dict.Remove(key2);
|
||||||
CHECK(dict.Length() == 0);
|
CHECK(dict.Length() == 0);
|
||||||
uint32_t* lookup2 = dict.Lookup(key2);
|
uint32_t* lookup2 = dict.Lookup(key2);
|
||||||
CHECK(lookup2 == (uint32_t*)0);
|
CHECK(lookup2 == (uint32_t*)nullptr);
|
||||||
delete key2;
|
delete key2;
|
||||||
|
|
||||||
CHECK(dict.MaxLength() == 1);
|
CHECK(dict.MaxLength() == 1);
|
||||||
|
@ -132,7 +132,7 @@ TEST_CASE("dict nthentry")
|
||||||
|
|
||||||
// NthEntry returns null for unordered dicts
|
// NthEntry returns null for unordered dicts
|
||||||
uint32_t* lookup = unordered.NthEntry(0);
|
uint32_t* lookup = unordered.NthEntry(0);
|
||||||
CHECK(lookup == (uint32_t*)0);
|
CHECK(lookup == (uint32_t*)nullptr);
|
||||||
|
|
||||||
// Ordered dicts are based on order of insertion, nothing about the
|
// Ordered dicts are based on order of insertion, nothing about the
|
||||||
// data itself
|
// data itself
|
||||||
|
@ -256,7 +256,7 @@ void Dictionary::DeInit()
|
||||||
void* Dictionary::Lookup(const void* key, int key_size, hash_t hash) const
|
void* Dictionary::Lookup(const void* key, int key_size, hash_t hash) const
|
||||||
{
|
{
|
||||||
if ( ! tbl && ! tbl2 )
|
if ( ! tbl && ! tbl2 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
hash_t h;
|
hash_t h;
|
||||||
PList<DictEntry>* chain;
|
PList<DictEntry>* chain;
|
||||||
|
@ -280,7 +280,7 @@ void* Dictionary::Lookup(const void* key, int key_size, hash_t hash) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Dictionary::Insert(void* key, int key_size, hash_t hash, void* val,
|
void* Dictionary::Insert(void* key, int key_size, hash_t hash, void* val,
|
||||||
|
@ -314,7 +314,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
||||||
bool dont_delete)
|
bool dont_delete)
|
||||||
{
|
{
|
||||||
if ( ! tbl && ! tbl2 )
|
if ( ! tbl && ! tbl2 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
hash_t h;
|
hash_t h;
|
||||||
PList<DictEntry>* chain;
|
PList<DictEntry>* chain;
|
||||||
|
@ -334,7 +334,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! chain )
|
if ( ! chain )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
for ( int i = 0; i < chain->length(); ++i )
|
for ( int i = 0; i < chain->length(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -346,7 +346,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
||||||
void* entry_value = DoRemove(entry, h, chain, i);
|
void* entry_value = DoRemove(entry, h, chain, i);
|
||||||
|
|
||||||
if ( dont_delete )
|
if ( dont_delete )
|
||||||
entry->key = 0;
|
entry->key = nullptr;
|
||||||
|
|
||||||
delete entry;
|
delete entry;
|
||||||
--*num_entries_ptr;
|
--*num_entries_ptr;
|
||||||
|
@ -354,7 +354,7 @@ void* Dictionary::Remove(const void* key, int key_size, hash_t hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Dictionary::DoRemove(DictEntry* entry, hash_t h,
|
void* Dictionary::DoRemove(DictEntry* entry, hash_t h,
|
||||||
|
@ -395,7 +395,7 @@ void* Dictionary::DoRemove(DictEntry* entry, hash_t h,
|
||||||
void* Dictionary::NthEntry(int n, const void*& key, int& key_len) const
|
void* Dictionary::NthEntry(int n, const void*& key, int& key_len) const
|
||||||
{
|
{
|
||||||
if ( ! order || n < 0 || n >= Length() )
|
if ( ! order || n < 0 || n >= Length() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
DictEntry* entry = (*order)[n];
|
DictEntry* entry = (*order)[n];
|
||||||
key = entry->key;
|
key = entry->key;
|
||||||
|
@ -419,8 +419,8 @@ void* Dictionary::NextEntry(HashKey*& h, IterCookie*& cookie, int return_hash) c
|
||||||
{
|
{
|
||||||
const_cast<PList<IterCookie>*>(&cookies)->remove(cookie);
|
const_cast<PList<IterCookie>*>(&cookies)->remove(cookie);
|
||||||
delete cookie;
|
delete cookie;
|
||||||
cookie = 0;
|
cookie = nullptr;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are any inserted entries, return them first.
|
// If there are any inserted entries, return them first.
|
||||||
|
@ -486,8 +486,8 @@ void* Dictionary::NextEntry(HashKey*& h, IterCookie*& cookie, int return_hash) c
|
||||||
// a better way?
|
// a better way?
|
||||||
const_cast<PList<IterCookie>*>(&cookies)->remove(cookie);
|
const_cast<PList<IterCookie>*>(&cookies)->remove(cookie);
|
||||||
delete cookie;
|
delete cookie;
|
||||||
cookie = 0;
|
cookie = nullptr;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = (*ttbl[b])[0];
|
entry = (*ttbl[b])[0];
|
||||||
|
@ -604,7 +604,7 @@ void* Dictionary::Insert(DictEntry* new_entry, bool copy_key)
|
||||||
c->inserted.push_back(new_entry);
|
c->inserted.push_back(new_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Dictionary::NextPrime(int n) const
|
int Dictionary::NextPrime(int n) const
|
||||||
|
@ -665,7 +665,7 @@ void Dictionary::MoveChains()
|
||||||
if ( ! chain )
|
if ( ! chain )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tbl[tbl_next_ind - 1] = 0;
|
tbl[tbl_next_ind - 1] = nullptr;
|
||||||
|
|
||||||
for ( int j = 0; j < chain->length(); ++j )
|
for ( int j = 0; j < chain->length(); ++j )
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// True if the dictionary is ordered, false otherwise.
|
// True if the dictionary is ordered, false otherwise.
|
||||||
bool IsOrdered() const { return order != 0; }
|
bool IsOrdered() const { return order != nullptr; }
|
||||||
|
|
||||||
// If the dictionary is ordered then returns the n'th entry's value;
|
// If the dictionary is ordered then returns the n'th entry's value;
|
||||||
// the second method also returns the key. The first entry inserted
|
// the second method also returns the key. The first entry inserted
|
||||||
|
|
|
@ -12,7 +12,7 @@ EquivClass::EquivClass(int arg_size)
|
||||||
bck = new int[size];
|
bck = new int[size];
|
||||||
equiv_class = new int[size];
|
equiv_class = new int[size];
|
||||||
rep = new int[size];
|
rep = new int[size];
|
||||||
ccl_flags = 0;
|
ccl_flags = nullptr;
|
||||||
num_ecs = 0;
|
num_ecs = 0;
|
||||||
|
|
||||||
ec_nil = no_class = no_rep = size + 1;
|
ec_nil = no_class = no_rep = size + 1;
|
||||||
|
|
|
@ -74,10 +74,10 @@ void Event::Dispatch(bool no_remote)
|
||||||
|
|
||||||
EventMgr::EventMgr()
|
EventMgr::EventMgr()
|
||||||
{
|
{
|
||||||
head = tail = 0;
|
head = tail = nullptr;
|
||||||
current_src = SOURCE_LOCAL;
|
current_src = SOURCE_LOCAL;
|
||||||
current_aid = 0;
|
current_aid = 0;
|
||||||
src_val = 0;
|
src_val = nullptr;
|
||||||
draining = false;
|
draining = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +176,8 @@ void EventMgr::Drain()
|
||||||
for ( int round = 0; head && round < 2; round++ )
|
for ( int round = 0; head && round < 2; round++ )
|
||||||
{
|
{
|
||||||
Event* current = head;
|
Event* current = head;
|
||||||
head = 0;
|
head = nullptr;
|
||||||
tail = 0;
|
tail = nullptr;
|
||||||
|
|
||||||
while ( current )
|
while ( current )
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||||
void QueueEventFast(const EventHandlerPtr &h, val_list vl,
|
void QueueEventFast(const EventHandlerPtr &h, val_list vl,
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
||||||
|
|
||||||
// Queues an event if there's an event handler (or remote consumer). This
|
// Queues an event if there's an event handler (or remote consumer). This
|
||||||
// function always takes ownership of decrementing the reference count of
|
// function always takes ownership of decrementing the reference count of
|
||||||
|
@ -75,7 +75,7 @@ public:
|
||||||
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||||
void QueueEvent(const EventHandlerPtr &h, val_list vl,
|
void QueueEvent(const EventHandlerPtr &h, val_list vl,
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
||||||
|
|
||||||
// Same as QueueEvent, except taking the event's argument list via a
|
// Same as QueueEvent, except taking the event's argument list via a
|
||||||
// pointer instead of by value. This function takes ownership of the
|
// pointer instead of by value. This function takes ownership of the
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||||
void QueueEvent(const EventHandlerPtr &h, val_list* vl,
|
void QueueEvent(const EventHandlerPtr &h, val_list* vl,
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an event to the queue. If no handler is found for the event
|
* Adds an event to the queue. If no handler is found for the event
|
||||||
|
@ -117,7 +117,7 @@ public:
|
||||||
void Drain();
|
void Drain();
|
||||||
bool IsDraining() const { return draining; }
|
bool IsDraining() const { return draining; }
|
||||||
|
|
||||||
bool HasEvents() const { return head != 0; }
|
bool HasEvents() const { return head != nullptr; }
|
||||||
|
|
||||||
// Returns the source ID of last raised event.
|
// Returns the source ID of last raised event.
|
||||||
SourceID CurrentSource() const { return current_src; }
|
SourceID CurrentSource() const { return current_src; }
|
||||||
|
|
|
@ -13,8 +13,8 @@ EventHandler::EventHandler(const char* arg_name)
|
||||||
{
|
{
|
||||||
name = copy_string(arg_name);
|
name = copy_string(arg_name);
|
||||||
used = false;
|
used = false;
|
||||||
local = 0;
|
local = nullptr;
|
||||||
type = 0;
|
type = nullptr;
|
||||||
error_handler = false;
|
error_handler = false;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
generate_always = false;
|
generate_always = false;
|
||||||
|
@ -42,10 +42,10 @@ FuncType* EventHandler::FType(bool check_export)
|
||||||
check_export);
|
check_export);
|
||||||
|
|
||||||
if ( ! id )
|
if ( ! id )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( id->Type()->Tag() != TYPE_FUNC )
|
if ( id->Type()->Tag() != TYPE_FUNC )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
type = id->Type()->AsFuncType();
|
type = id->Type()->AsFuncType();
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -69,7 +69,7 @@ private:
|
||||||
// Encapsulates a ptr to an event handler to overload the boolean operator.
|
// Encapsulates a ptr to an event handler to overload the boolean operator.
|
||||||
class EventHandlerPtr {
|
class EventHandlerPtr {
|
||||||
public:
|
public:
|
||||||
EventHandlerPtr(EventHandler* p = 0) { handler = p; }
|
EventHandlerPtr(EventHandler* p = nullptr) { handler = p; }
|
||||||
EventHandlerPtr(const EventHandlerPtr& h) { handler = h.handler; }
|
EventHandlerPtr(const EventHandlerPtr& h) { handler = h.handler; }
|
||||||
|
|
||||||
const EventHandlerPtr& operator=(EventHandler* p)
|
const EventHandlerPtr& operator=(EventHandler* p)
|
||||||
|
|
46
src/Expr.cc
46
src/Expr.cc
|
@ -54,7 +54,7 @@ const char* expr_name(BroExprTag t)
|
||||||
return expr_names[int(t)];
|
return expr_names[int(t)];
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), type(0), paren(false)
|
Expr::Expr(BroExprTag arg_tag) : tag(arg_tag), type(nullptr), paren(false)
|
||||||
{
|
{
|
||||||
SetLocationInfo(&start_location, &end_location);
|
SetLocationInfo(&start_location, &end_location);
|
||||||
}
|
}
|
||||||
|
@ -1623,7 +1623,7 @@ IntrusivePtr<Val> BoolExpr::Eval(Frame* f) const
|
||||||
result->Assign(i, val_mgr->GetBool(local_result));
|
result->Assign(i, val_mgr->GetBool(local_result));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result->Assign(i, 0);
|
result->Assign(i, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1952,7 +1952,7 @@ IntrusivePtr<Val> CondExpr::Eval(Frame* f) const
|
||||||
result->Assign(i, v ? v->Ref() : nullptr);
|
result->Assign(i, v ? v->Ref() : nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result->Assign(i, 0);
|
result->Assign(i, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -2019,7 +2019,7 @@ AssignExpr::AssignExpr(IntrusivePtr<Expr> arg_op1, IntrusivePtr<Expr> arg_op2,
|
||||||
std::move(arg_op1) : arg_op1->MakeLvalue(),
|
std::move(arg_op1) : arg_op1->MakeLvalue(),
|
||||||
std::move(arg_op2))
|
std::move(arg_op2))
|
||||||
{
|
{
|
||||||
val = 0;
|
val = nullptr;
|
||||||
is_init = arg_is_init;
|
is_init = arg_is_init;
|
||||||
|
|
||||||
if ( IsError() )
|
if ( IsError() )
|
||||||
|
@ -2079,7 +2079,7 @@ bool AssignExpr::TypeCheck(attr_list* attrs)
|
||||||
|
|
||||||
if ( bt1 == TYPE_TABLE && op2->Tag() == EXPR_LIST )
|
if ( bt1 == TYPE_TABLE && op2->Tag() == EXPR_LIST )
|
||||||
{
|
{
|
||||||
attr_list* attr_copy = 0;
|
attr_list* attr_copy = nullptr;
|
||||||
|
|
||||||
if ( attrs )
|
if ( attrs )
|
||||||
{
|
{
|
||||||
|
@ -2178,7 +2178,7 @@ bool AssignExpr::TypeCheck(attr_list* attrs)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
attr_list* attr_copy = 0;
|
attr_list* attr_copy = nullptr;
|
||||||
|
|
||||||
if ( sce->Attrs() )
|
if ( sce->Attrs() )
|
||||||
{
|
{
|
||||||
|
@ -2293,7 +2293,7 @@ void AssignExpr::EvalIntoAggregate(const BroType* t, Val* aggr, Frame* f) const
|
||||||
if ( IsError() )
|
if ( IsError() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TypeDecl td(0, 0);
|
TypeDecl td(nullptr, nullptr);
|
||||||
|
|
||||||
if ( IsRecordElement(&td) )
|
if ( IsRecordElement(&td) )
|
||||||
{
|
{
|
||||||
|
@ -2348,7 +2348,7 @@ IntrusivePtr<Val> AssignExpr::InitVal(const BroType* t, IntrusivePtr<Val> aggr)
|
||||||
if ( IsError() )
|
if ( IsError() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
TypeDecl td(0, 0);
|
TypeDecl td(nullptr, nullptr);
|
||||||
|
|
||||||
if ( IsRecordElement(&td) )
|
if ( IsRecordElement(&td) )
|
||||||
{
|
{
|
||||||
|
@ -2690,7 +2690,7 @@ IntrusivePtr<Val> IndexExpr::Fold(Val* v1, Val* v2) const
|
||||||
const ListVal* lv = v2->AsListVal();
|
const ListVal* lv = v2->AsListVal();
|
||||||
const BroString* s = v1->AsString();
|
const BroString* s = v1->AsString();
|
||||||
int len = s->Len();
|
int len = s->Len();
|
||||||
BroString* substring = 0;
|
BroString* substring = nullptr;
|
||||||
|
|
||||||
if ( lv->Length() == 1 )
|
if ( lv->Length() == 1 )
|
||||||
{
|
{
|
||||||
|
@ -2709,7 +2709,7 @@ IntrusivePtr<Val> IndexExpr::Fold(Val* v1, Val* v2) const
|
||||||
bro_int_t substring_len = last - first;
|
bro_int_t substring_len = last - first;
|
||||||
|
|
||||||
if ( substring_len < 0 )
|
if ( substring_len < 0 )
|
||||||
substring = 0;
|
substring = nullptr;
|
||||||
else
|
else
|
||||||
substring = s->GetSubstring(first, substring_len);
|
substring = s->GetSubstring(first, substring_len);
|
||||||
}
|
}
|
||||||
|
@ -2851,7 +2851,7 @@ TraversalCode IndexExpr::Traverse(TraversalCallback* cb) const
|
||||||
|
|
||||||
FieldExpr::FieldExpr(IntrusivePtr<Expr> arg_op, const char* arg_field_name)
|
FieldExpr::FieldExpr(IntrusivePtr<Expr> arg_op, const char* arg_field_name)
|
||||||
: UnaryExpr(EXPR_FIELD, std::move(arg_op)),
|
: UnaryExpr(EXPR_FIELD, std::move(arg_op)),
|
||||||
field_name(copy_string(arg_field_name)), td(0), field(0)
|
field_name(copy_string(arg_field_name)), td(nullptr), field(0)
|
||||||
{
|
{
|
||||||
if ( IsError() )
|
if ( IsError() )
|
||||||
return;
|
return;
|
||||||
|
@ -2905,7 +2905,7 @@ void FieldExpr::Assign(Frame* f, IntrusivePtr<Val> v)
|
||||||
|
|
||||||
void FieldExpr::Delete(Frame* f)
|
void FieldExpr::Delete(Frame* f)
|
||||||
{
|
{
|
||||||
Assign(f, 0);
|
Assign(f, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrusivePtr<Val> FieldExpr::Fold(Val* v) const
|
IntrusivePtr<Val> FieldExpr::Fold(Val* v) const
|
||||||
|
@ -2914,7 +2914,7 @@ IntrusivePtr<Val> FieldExpr::Fold(Val* v) const
|
||||||
return {NewRef{}, result};
|
return {NewRef{}, result};
|
||||||
|
|
||||||
// Check for &default.
|
// Check for &default.
|
||||||
const Attr* def_attr = td ? td->FindAttr(ATTR_DEFAULT) : 0;
|
const Attr* def_attr = td ? td->FindAttr(ATTR_DEFAULT) : nullptr;
|
||||||
|
|
||||||
if ( def_attr )
|
if ( def_attr )
|
||||||
return def_attr->AttrExpr()->Eval(nullptr);
|
return def_attr->AttrExpr()->Eval(nullptr);
|
||||||
|
@ -3101,7 +3101,7 @@ TableConstructorExpr::TableConstructorExpr(IntrusivePtr<ListExpr> constructor_li
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : 0;
|
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : nullptr;
|
||||||
|
|
||||||
type_list* indices = type->AsTableType()->Indices()->Types();
|
type_list* indices = type->AsTableType()->Indices()->Types();
|
||||||
const expr_list& cle = op->AsListExpr()->Exprs();
|
const expr_list& cle = op->AsListExpr()->Exprs();
|
||||||
|
@ -3173,7 +3173,7 @@ IntrusivePtr<Val> TableConstructorExpr::InitVal(const BroType* t, IntrusivePtr<V
|
||||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||||
|
|
||||||
for ( const auto& expr : exprs )
|
for ( const auto& expr : exprs )
|
||||||
expr->EvalIntoAggregate(t, tval.get(), 0);
|
expr->EvalIntoAggregate(t, tval.get(), nullptr);
|
||||||
|
|
||||||
return tval;
|
return tval;
|
||||||
}
|
}
|
||||||
|
@ -3219,7 +3219,7 @@ SetConstructorExpr::SetConstructorExpr(IntrusivePtr<ListExpr> constructor_list,
|
||||||
else if ( type->Tag() != TYPE_TABLE || ! type->AsTableType()->IsSet() )
|
else if ( type->Tag() != TYPE_TABLE || ! type->AsTableType()->IsSet() )
|
||||||
SetError("values in set(...) constructor do not specify a set");
|
SetError("values in set(...) constructor do not specify a set");
|
||||||
|
|
||||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : 0;
|
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : nullptr;
|
||||||
|
|
||||||
type_list* indices = type->AsTableType()->Indices()->Types();
|
type_list* indices = type->AsTableType()->Indices()->Types();
|
||||||
expr_list& cle = op->AsListExpr()->Exprs();
|
expr_list& cle = op->AsListExpr()->Exprs();
|
||||||
|
@ -3265,7 +3265,7 @@ IntrusivePtr<Val> SetConstructorExpr::Eval(Frame* f) const
|
||||||
for ( const auto& expr : exprs )
|
for ( const auto& expr : exprs )
|
||||||
{
|
{
|
||||||
auto element = expr->Eval(f);
|
auto element = expr->Eval(f);
|
||||||
aggr->Assign(element.get(), 0);
|
aggr->Assign(element.get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return aggr;
|
return aggr;
|
||||||
|
@ -3287,7 +3287,7 @@ IntrusivePtr<Val> SetConstructorExpr::InitVal(const BroType* t, IntrusivePtr<Val
|
||||||
{
|
{
|
||||||
auto element = check_and_promote(e->Eval(nullptr), index_type, true);
|
auto element = check_and_promote(e->Eval(nullptr), index_type, true);
|
||||||
|
|
||||||
if ( ! element || ! tval->Assign(element.get(), 0) )
|
if ( ! element || ! tval->Assign(element.get(), nullptr) )
|
||||||
{
|
{
|
||||||
Error(fmt("initialization type mismatch in set"), e);
|
Error(fmt("initialization type mismatch in set"), e);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -3521,7 +3521,7 @@ IntrusivePtr<Val> ArithCoerceExpr::Fold(Val* v) const
|
||||||
if ( Val* elt = vv->Lookup(i) )
|
if ( Val* elt = vv->Lookup(i) )
|
||||||
result->Assign(i, FoldSingleVal(elt, t));
|
result->Assign(i, FoldSingleVal(elt, t));
|
||||||
else
|
else
|
||||||
result->Assign(i, 0);
|
result->Assign(i, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -4191,7 +4191,7 @@ IntrusivePtr<Val> CallExpr::Eval(Frame* f) const
|
||||||
if ( func_val && v )
|
if ( func_val && v )
|
||||||
{
|
{
|
||||||
const ::Func* funcv = func_val->AsFunc();
|
const ::Func* funcv = func_val->AsFunc();
|
||||||
const CallExpr* current_call = f ? f->GetCall() : 0;
|
const CallExpr* current_call = f ? f->GetCall() : nullptr;
|
||||||
|
|
||||||
if ( f )
|
if ( f )
|
||||||
f->SetCall(this);
|
f->SetCall(this);
|
||||||
|
@ -4491,12 +4491,12 @@ IntrusivePtr<BroType> ListExpr::InitType() const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( exprs[0]->IsRecordElement(0) )
|
if ( exprs[0]->IsRecordElement(nullptr) )
|
||||||
{
|
{
|
||||||
type_decl_list* types = new type_decl_list(exprs.length());
|
type_decl_list* types = new type_decl_list(exprs.length());
|
||||||
for ( const auto& expr : exprs )
|
for ( const auto& expr : exprs )
|
||||||
{
|
{
|
||||||
TypeDecl* td = new TypeDecl(0, 0);
|
TypeDecl* td = new TypeDecl(nullptr, nullptr);
|
||||||
if ( ! expr->IsRecordElement(td) )
|
if ( ! expr->IsRecordElement(td) )
|
||||||
{
|
{
|
||||||
expr->Error("record element expected");
|
expr->Error("record element expected");
|
||||||
|
@ -5063,7 +5063,7 @@ bool check_and_promote_args(ListExpr* const args, RecordType* types)
|
||||||
for ( int i = ntypes - 1; i >= el.length(); --i )
|
for ( int i = ntypes - 1; i >= el.length(); --i )
|
||||||
{
|
{
|
||||||
TypeDecl* td = types->FieldDecl(i);
|
TypeDecl* td = types->FieldDecl(i);
|
||||||
Attr* def_attr = td->attrs ? td->attrs->FindAttr(ATTR_DEFAULT) : 0;
|
Attr* def_attr = td->attrs ? td->attrs->FindAttr(ATTR_DEFAULT) : nullptr;
|
||||||
|
|
||||||
if ( ! def_attr )
|
if ( ! def_attr )
|
||||||
{
|
{
|
||||||
|
|
|
@ -523,7 +523,7 @@ public:
|
||||||
bool IsPure() const override;
|
bool IsPure() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool TypeCheck(attr_list* attrs = 0);
|
bool TypeCheck(attr_list* attrs = nullptr);
|
||||||
bool TypeCheckArithmetics(TypeTag bt1, TypeTag bt2);
|
bool TypeCheckArithmetics(TypeTag bt1, TypeTag bt2);
|
||||||
|
|
||||||
bool is_init;
|
bool is_init;
|
||||||
|
|
22
src/File.cc
22
src/File.cc
|
@ -56,9 +56,9 @@ BroFile::BroFile(FILE* arg_f)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
f = arg_f;
|
f = arg_f;
|
||||||
name = access = 0;
|
name = access = nullptr;
|
||||||
t = base_type(TYPE_STRING);
|
t = base_type(TYPE_STRING);
|
||||||
is_open = (f != 0);
|
is_open = (f != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
||||||
|
@ -68,13 +68,13 @@ BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
||||||
name = copy_string(arg_name);
|
name = copy_string(arg_name);
|
||||||
access = copy_string(arg_access);
|
access = copy_string(arg_access);
|
||||||
t = base_type(TYPE_STRING);
|
t = base_type(TYPE_STRING);
|
||||||
is_open = (f != 0);
|
is_open = (f != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
BroFile::BroFile(const char* arg_name, const char* arg_access)
|
BroFile::BroFile(const char* arg_name, const char* arg_access)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
f = 0;
|
f = nullptr;
|
||||||
name = copy_string(arg_name);
|
name = copy_string(arg_name);
|
||||||
access = copy_string(arg_access);
|
access = copy_string(arg_access);
|
||||||
t = base_type(TYPE_STRING);
|
t = base_type(TYPE_STRING);
|
||||||
|
@ -110,7 +110,7 @@ const char* BroFile::Name() const
|
||||||
if ( f == stderr )
|
if ( f == stderr )
|
||||||
return "/dev/stderr";
|
return "/dev/stderr";
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BroFile::Open(FILE* file, const char* mode)
|
bool BroFile::Open(FILE* file, const char* mode)
|
||||||
|
@ -168,7 +168,7 @@ void BroFile::Init()
|
||||||
{
|
{
|
||||||
open_time = 0;
|
open_time = 0;
|
||||||
is_open = false;
|
is_open = false;
|
||||||
attrs = 0;
|
attrs = nullptr;
|
||||||
buffered = true;
|
buffered = true;
|
||||||
raw_output = false;
|
raw_output = false;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ FILE* BroFile::File()
|
||||||
FILE* BroFile::Seek(long new_position)
|
FILE* BroFile::Seek(long new_position)
|
||||||
{
|
{
|
||||||
if ( ! File() )
|
if ( ! File() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( fseek(f, new_position, SEEK_SET) < 0 )
|
if ( fseek(f, new_position, SEEK_SET) < 0 )
|
||||||
reporter->Error("seek failed");
|
reporter->Error("seek failed");
|
||||||
|
@ -271,11 +271,11 @@ void BroFile::SetAttrs(Attributes* arg_attrs)
|
||||||
RecordVal* BroFile::Rotate()
|
RecordVal* BroFile::Rotate()
|
||||||
{
|
{
|
||||||
if ( ! is_open )
|
if ( ! is_open )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
// Do not rotate stdin/stdout/stderr.
|
// Do not rotate stdin/stdout/stderr.
|
||||||
if ( f == stdin || f == stdout || f == stderr )
|
if ( f == stdin || f == stdout || f == stderr )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
RecordVal* info = new RecordVal(rotate_info);
|
RecordVal* info = new RecordVal(rotate_info);
|
||||||
FILE* newf = rotate_file(name, info);
|
FILE* newf = rotate_file(name, info);
|
||||||
|
@ -283,7 +283,7 @@ RecordVal* BroFile::Rotate()
|
||||||
if ( ! newf )
|
if ( ! newf )
|
||||||
{
|
{
|
||||||
Unref(info);
|
Unref(info);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->Assign(2, make_intrusive<Val>(open_time, TYPE_TIME));
|
info->Assign(2, make_intrusive<Val>(open_time, TYPE_TIME));
|
||||||
|
@ -291,7 +291,7 @@ RecordVal* BroFile::Rotate()
|
||||||
Unlink();
|
Unlink();
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
f = 0;
|
f = nullptr;
|
||||||
|
|
||||||
Open(newf);
|
Open(newf);
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -80,7 +80,7 @@ protected:
|
||||||
* If file is not given and mode is, the filename will be opened with that
|
* If file is not given and mode is, the filename will be opened with that
|
||||||
* access mode.
|
* access mode.
|
||||||
*/
|
*/
|
||||||
bool Open(FILE* f = nullptr, const char* mode = 0);
|
bool Open(FILE* f = nullptr, const char* mode = nullptr);
|
||||||
|
|
||||||
void Unlink();
|
void Unlink();
|
||||||
|
|
||||||
|
|
10
src/Frag.cc
10
src/Frag.cc
|
@ -49,7 +49,7 @@ FragReassembler::FragReassembler(NetSessions* arg_s,
|
||||||
memcpy(proto_hdr, ip->IP6_Hdr(), proto_hdr_len);
|
memcpy(proto_hdr, ip->IP6_Hdr(), proto_hdr_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
reassembled_pkt = 0;
|
reassembled_pkt = nullptr;
|
||||||
frag_size = 0; // flag meaning "not known"
|
frag_size = 0; // flag meaning "not known"
|
||||||
next_proto = ip->NextProto();
|
next_proto = ip->NextProto();
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ FragReassembler::FragReassembler(NetSessions* arg_s,
|
||||||
timer_mgr->Add(expire_timer);
|
timer_mgr->Add(expire_timer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
expire_timer = 0;
|
expire_timer = nullptr;
|
||||||
|
|
||||||
AddFragment(t, ip, pkt);
|
AddFragment(t, ip, pkt);
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ void FragReassembler::BlockInserted(DataBlockMap::const_iterator /* it */)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete reassembled_pkt;
|
delete reassembled_pkt;
|
||||||
reassembled_pkt = 0;
|
reassembled_pkt = nullptr;
|
||||||
|
|
||||||
unsigned int version = ((const struct ip*)pkt_start)->ip_v;
|
unsigned int version = ((const struct ip*)pkt_start)->ip_v;
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ void FragReassembler::Expire(double t)
|
||||||
{
|
{
|
||||||
block_list.Clear();
|
block_list.Clear();
|
||||||
expire_timer->ClearReassembler();
|
expire_timer->ClearReassembler();
|
||||||
expire_timer = 0; // timer manager will delete it
|
expire_timer = nullptr; // timer manager will delete it
|
||||||
|
|
||||||
sessions->Remove(this);
|
sessions->Remove(this);
|
||||||
}
|
}
|
||||||
|
@ -329,6 +329,6 @@ void FragReassembler::DeleteTimer()
|
||||||
{
|
{
|
||||||
expire_timer->ClearReassembler();
|
expire_timer->ClearReassembler();
|
||||||
timer_mgr->Cancel(expire_timer);
|
timer_mgr->Cancel(expire_timer);
|
||||||
expire_timer = 0; // timer manager will delete it
|
expire_timer = nullptr; // timer manager will delete it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
|
|
||||||
void Expire(double t);
|
void Expire(double t);
|
||||||
void DeleteTimer();
|
void DeleteTimer();
|
||||||
void ClearTimer() { expire_timer = 0; }
|
void ClearTimer() { expire_timer = nullptr; }
|
||||||
|
|
||||||
const IP_Hdr* ReassembledPkt() { return reassembled_pkt; }
|
const IP_Hdr* ReassembledPkt() { return reassembled_pkt; }
|
||||||
const FragReassemblerKey& Key() const { return key; }
|
const FragReassemblerKey& Key() const { return key; }
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
void Dispatch(double t, bool is_expire) override;
|
void Dispatch(double t, bool is_expire) override;
|
||||||
|
|
||||||
// Break the association between this timer and its creator.
|
// Break the association between this timer and its creator.
|
||||||
void ClearReassembler() { f = 0; }
|
void ClearReassembler() { f = nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FragReassembler* f;
|
FragReassembler* f;
|
||||||
|
|
|
@ -136,7 +136,7 @@ void Frame::Reset(int startIdx)
|
||||||
for ( int i = startIdx; i < size; ++i )
|
for ( int i = startIdx; i < size; ++i )
|
||||||
{
|
{
|
||||||
UnrefElement(i);
|
UnrefElement(i);
|
||||||
frame[i] = 0;
|
frame[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ void Frame::Describe(ODesc* d) const
|
||||||
|
|
||||||
for ( int i = 0; i < size; ++i )
|
for ( int i = 0; i < size; ++i )
|
||||||
{
|
{
|
||||||
d->Add(frame[i] != 0);
|
d->Add(frame[i] != nullptr);
|
||||||
d->SP();
|
d->SP();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ public:
|
||||||
trigger::Trigger* GetTrigger() const { return trigger.get(); }
|
trigger::Trigger* GetTrigger() const { return trigger.get(); }
|
||||||
|
|
||||||
void SetCall(const CallExpr* arg_call) { call = arg_call; }
|
void SetCall(const CallExpr* arg_call) { call = arg_call; }
|
||||||
void ClearCall() { call = 0; }
|
void ClearCall() { call = nullptr; }
|
||||||
const CallExpr* GetCall() const { return call; }
|
const CallExpr* GetCall() const { return call; }
|
||||||
|
|
||||||
void SetDelayed() { delayed = true; }
|
void SetDelayed() { delayed = true; }
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
|
|
||||||
uint32_t GetUniqueFuncID() const { return unique_id; }
|
uint32_t GetUniqueFuncID() const { return unique_id; }
|
||||||
static Func* GetFuncPtrByID(uint32_t id)
|
static Func* GetFuncPtrByID(uint32_t id)
|
||||||
{ return id >= unique_ids.size() ? 0 : unique_ids[id]; }
|
{ return id >= unique_ids.size() ? nullptr : unique_ids[id]; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Func();
|
Func();
|
||||||
|
@ -205,7 +205,7 @@ public:
|
||||||
void Describe(ODesc* d) const override;
|
void Describe(ODesc* d) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BuiltinFunc() { func = 0; is_pure = 0; }
|
BuiltinFunc() { func = nullptr; is_pure = 0; }
|
||||||
|
|
||||||
built_in_func func;
|
built_in_func func;
|
||||||
bool is_pure;
|
bool is_pure;
|
||||||
|
|
12
src/ID.cc
12
src/ID.cc
|
@ -25,7 +25,7 @@ ID::ID(const char* arg_name, IDScope arg_scope, bool arg_is_export)
|
||||||
scope = arg_scope;
|
scope = arg_scope;
|
||||||
is_export = arg_is_export;
|
is_export = arg_is_export;
|
||||||
is_option = false;
|
is_option = false;
|
||||||
val = 0;
|
val = nullptr;
|
||||||
is_const = false;
|
is_const = false;
|
||||||
is_enum_const = false;
|
is_enum_const = false;
|
||||||
is_type = false;
|
is_type = false;
|
||||||
|
@ -60,7 +60,7 @@ void ID::ClearVal()
|
||||||
if ( ! weak_ref )
|
if ( ! weak_ref )
|
||||||
Unref(val);
|
Unref(val);
|
||||||
|
|
||||||
val = 0;
|
val = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ID::SetVal(IntrusivePtr<Val> v, bool arg_weak_ref)
|
void ID::SetVal(IntrusivePtr<Val> v, bool arg_weak_ref)
|
||||||
|
@ -147,12 +147,12 @@ void ID::SetVal(IntrusivePtr<Expr> ev, init_class c)
|
||||||
|
|
||||||
bool ID::IsRedefinable() const
|
bool ID::IsRedefinable() const
|
||||||
{
|
{
|
||||||
return FindAttr(ATTR_REDEF) != 0;
|
return FindAttr(ATTR_REDEF) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ID::SetAttrs(IntrusivePtr<Attributes> a)
|
void ID::SetAttrs(IntrusivePtr<Attributes> a)
|
||||||
{
|
{
|
||||||
attrs = 0;
|
attrs = nullptr;
|
||||||
AddAttrs(std::move(a));
|
AddAttrs(std::move(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,12 +197,12 @@ void ID::UpdateValAttrs()
|
||||||
|
|
||||||
Attr* ID::FindAttr(attr_tag t) const
|
Attr* ID::FindAttr(attr_tag t) const
|
||||||
{
|
{
|
||||||
return attrs ? attrs->FindAttr(t) : 0;
|
return attrs ? attrs->FindAttr(t) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ID::IsDeprecated() const
|
bool ID::IsDeprecated() const
|
||||||
{
|
{
|
||||||
return FindAttr(ATTR_DEPRECATED) != 0;
|
return FindAttr(ATTR_DEPRECATED) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ID::MakeDeprecated(IntrusivePtr<Expr> deprecation)
|
void ID::MakeDeprecated(IntrusivePtr<Expr> deprecation)
|
||||||
|
|
8
src/ID.h
8
src/ID.h
|
@ -41,8 +41,8 @@ public:
|
||||||
const BroType* Type() const { return type.get(); }
|
const BroType* Type() const { return type.get(); }
|
||||||
|
|
||||||
void MakeType() { is_type = true; }
|
void MakeType() { is_type = true; }
|
||||||
BroType* AsType() { return is_type ? Type() : 0; }
|
BroType* AsType() { return is_type ? Type() : nullptr; }
|
||||||
const BroType* AsType() const { return is_type ? Type() : 0; }
|
const BroType* AsType() const { return is_type ? Type() : nullptr; }
|
||||||
|
|
||||||
// If weak_ref is false, the Val is assumed to be already ref'ed
|
// If weak_ref is false, the Val is assumed to be already ref'ed
|
||||||
// and will be deref'ed when the ID is deleted.
|
// and will be deref'ed when the ID is deleted.
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
void SetVal(IntrusivePtr<Val> v, init_class c);
|
void SetVal(IntrusivePtr<Val> v, init_class c);
|
||||||
void SetVal(IntrusivePtr<Expr> ev, init_class c);
|
void SetVal(IntrusivePtr<Expr> ev, init_class c);
|
||||||
|
|
||||||
bool HasVal() const { return val != 0; }
|
bool HasVal() const { return val != nullptr; }
|
||||||
Val* ID_Val() { return val; }
|
Val* ID_Val() { return val; }
|
||||||
const Val* ID_Val() const { return val; }
|
const Val* ID_Val() const { return val; }
|
||||||
void ClearVal();
|
void ClearVal();
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
|
|
||||||
std::string GetDeprecationWarning() const;
|
std::string GetDeprecationWarning() const;
|
||||||
|
|
||||||
void Error(const char* msg, const BroObj* o2 = 0);
|
void Error(const char* msg, const BroObj* o2 = nullptr);
|
||||||
|
|
||||||
void Describe(ODesc* d) const override;
|
void Describe(ODesc* d) const override;
|
||||||
// Adds type and value to description.
|
// Adds type and value to description.
|
||||||
|
|
52
src/IP.cc
52
src/IP.cc
|
@ -13,26 +13,26 @@
|
||||||
#include "BroString.h"
|
#include "BroString.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
|
|
||||||
static RecordType* ip4_hdr_type = 0;
|
static RecordType* ip4_hdr_type = nullptr;
|
||||||
static RecordType* ip6_hdr_type = 0;
|
static RecordType* ip6_hdr_type = nullptr;
|
||||||
static RecordType* ip6_ext_hdr_type = 0;
|
static RecordType* ip6_ext_hdr_type = nullptr;
|
||||||
static RecordType* ip6_option_type = 0;
|
static RecordType* ip6_option_type = nullptr;
|
||||||
static RecordType* ip6_hopopts_type = 0;
|
static RecordType* ip6_hopopts_type = nullptr;
|
||||||
static RecordType* ip6_dstopts_type = 0;
|
static RecordType* ip6_dstopts_type = nullptr;
|
||||||
static RecordType* ip6_routing_type = 0;
|
static RecordType* ip6_routing_type = nullptr;
|
||||||
static RecordType* ip6_fragment_type = 0;
|
static RecordType* ip6_fragment_type = nullptr;
|
||||||
static RecordType* ip6_ah_type = 0;
|
static RecordType* ip6_ah_type = nullptr;
|
||||||
static RecordType* ip6_esp_type = 0;
|
static RecordType* ip6_esp_type = nullptr;
|
||||||
static RecordType* ip6_mob_type = 0;
|
static RecordType* ip6_mob_type = nullptr;
|
||||||
static RecordType* ip6_mob_msg_type = 0;
|
static RecordType* ip6_mob_msg_type = nullptr;
|
||||||
static RecordType* ip6_mob_brr_type = 0;
|
static RecordType* ip6_mob_brr_type = nullptr;
|
||||||
static RecordType* ip6_mob_hoti_type = 0;
|
static RecordType* ip6_mob_hoti_type = nullptr;
|
||||||
static RecordType* ip6_mob_coti_type = 0;
|
static RecordType* ip6_mob_coti_type = nullptr;
|
||||||
static RecordType* ip6_mob_hot_type = 0;
|
static RecordType* ip6_mob_hot_type = nullptr;
|
||||||
static RecordType* ip6_mob_cot_type = 0;
|
static RecordType* ip6_mob_cot_type = nullptr;
|
||||||
static RecordType* ip6_mob_bu_type = 0;
|
static RecordType* ip6_mob_bu_type = nullptr;
|
||||||
static RecordType* ip6_mob_back_type = 0;
|
static RecordType* ip6_mob_back_type = nullptr;
|
||||||
static RecordType* ip6_mob_be_type = 0;
|
static RecordType* ip6_mob_be_type = nullptr;
|
||||||
|
|
||||||
static inline RecordType* hdrType(RecordType*& type, const char* name)
|
static inline RecordType* hdrType(RecordType*& type, const char* name)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ static VectorVal* BuildOptionsVal(const u_char* data, int len)
|
||||||
|
|
||||||
RecordVal* IPv6_Hdr::BuildRecordVal(VectorVal* chain) const
|
RecordVal* IPv6_Hdr::BuildRecordVal(VectorVal* chain) const
|
||||||
{
|
{
|
||||||
RecordVal* rv = 0;
|
RecordVal* rv = nullptr;
|
||||||
|
|
||||||
switch ( type ) {
|
switch ( type ) {
|
||||||
case IPPROTO_IPV6:
|
case IPPROTO_IPV6:
|
||||||
|
@ -330,7 +330,7 @@ IPAddr IP_Hdr::DstAddr() const
|
||||||
|
|
||||||
RecordVal* IP_Hdr::BuildIPHdrVal() const
|
RecordVal* IP_Hdr::BuildIPHdrVal() const
|
||||||
{
|
{
|
||||||
RecordVal* rval = 0;
|
RecordVal* rval = nullptr;
|
||||||
|
|
||||||
if ( ip4 )
|
if ( ip4 )
|
||||||
{
|
{
|
||||||
|
@ -354,7 +354,7 @@ RecordVal* IP_Hdr::BuildIPHdrVal() const
|
||||||
|
|
||||||
RecordVal* IP_Hdr::BuildPktHdrVal() const
|
RecordVal* IP_Hdr::BuildPktHdrVal() const
|
||||||
{
|
{
|
||||||
static RecordType* pkt_hdr_type = 0;
|
static RecordType* pkt_hdr_type = nullptr;
|
||||||
|
|
||||||
if ( ! pkt_hdr_type )
|
if ( ! pkt_hdr_type )
|
||||||
pkt_hdr_type = internal_type("pkt_hdr")->AsRecordType();
|
pkt_hdr_type = internal_type("pkt_hdr")->AsRecordType();
|
||||||
|
@ -365,9 +365,9 @@ RecordVal* IP_Hdr::BuildPktHdrVal() const
|
||||||
|
|
||||||
RecordVal* IP_Hdr::BuildPktHdrVal(RecordVal* pkt_hdr, int sindex) const
|
RecordVal* IP_Hdr::BuildPktHdrVal(RecordVal* pkt_hdr, int sindex) const
|
||||||
{
|
{
|
||||||
static RecordType* tcp_hdr_type = 0;
|
static RecordType* tcp_hdr_type = nullptr;
|
||||||
static RecordType* udp_hdr_type = 0;
|
static RecordType* udp_hdr_type = nullptr;
|
||||||
static RecordType* icmp_hdr_type = 0;
|
static RecordType* icmp_hdr_type = nullptr;
|
||||||
|
|
||||||
if ( ! tcp_hdr_type )
|
if ( ! tcp_hdr_type )
|
||||||
{
|
{
|
||||||
|
|
4
src/IP.h
4
src/IP.h
|
@ -136,7 +136,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Returns the script-layer record representation of the header.
|
* Returns the script-layer record representation of the header.
|
||||||
*/
|
*/
|
||||||
RecordVal* BuildRecordVal(VectorVal* chain = 0) const;
|
RecordVal* BuildRecordVal(VectorVal* chain = nullptr) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
@ -184,7 +184,7 @@ public:
|
||||||
*/
|
*/
|
||||||
const struct ip6_frag* GetFragHdr() const
|
const struct ip6_frag* GetFragHdr() const
|
||||||
{ return IsFragment() ?
|
{ return IsFragment() ?
|
||||||
(const struct ip6_frag*)chain[chain.size()-1]->Data(): 0; }
|
(const struct ip6_frag*)chain[chain.size()-1]->Data(): nullptr; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the header chain is a fragment, returns the offset in number of bytes
|
* If the header chain is a fragment, returns the offset in number of bytes
|
||||||
|
|
18
src/NFA.cc
18
src/NFA.cc
|
@ -14,11 +14,11 @@ static int nfa_state_id = 0;
|
||||||
NFA_State::NFA_State(int arg_sym, EquivClass* ec)
|
NFA_State::NFA_State(int arg_sym, EquivClass* ec)
|
||||||
{
|
{
|
||||||
sym = arg_sym;
|
sym = arg_sym;
|
||||||
ccl = 0;
|
ccl = nullptr;
|
||||||
accept = NO_ACCEPT;
|
accept = NO_ACCEPT;
|
||||||
first_trans_is_back_ref = false;
|
first_trans_is_back_ref = false;
|
||||||
mark = 0;
|
mark = nullptr;
|
||||||
epsclosure = 0;
|
epsclosure = nullptr;
|
||||||
id = ++nfa_state_id;
|
id = ++nfa_state_id;
|
||||||
|
|
||||||
// Fix up equivalence classes based on this transition. Note that any
|
// Fix up equivalence classes based on this transition. Note that any
|
||||||
|
@ -39,9 +39,9 @@ NFA_State::NFA_State(CCL* arg_ccl)
|
||||||
ccl = arg_ccl;
|
ccl = arg_ccl;
|
||||||
accept = NO_ACCEPT;
|
accept = NO_ACCEPT;
|
||||||
first_trans_is_back_ref = false;
|
first_trans_is_back_ref = false;
|
||||||
mark = 0;
|
mark = nullptr;
|
||||||
id = ++nfa_state_id;
|
id = ++nfa_state_id;
|
||||||
epsclosure = 0;
|
epsclosure = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
NFA_State::~NFA_State()
|
NFA_State::~NFA_State()
|
||||||
|
@ -67,7 +67,7 @@ NFA_State* NFA_State::DeepCopy()
|
||||||
return mark;
|
return mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
NFA_State* copy = ccl ? new NFA_State(ccl) : new NFA_State(sym, 0);
|
NFA_State* copy = ccl ? new NFA_State(ccl) : new NFA_State(sym, nullptr);
|
||||||
SetMark(copy);
|
SetMark(copy);
|
||||||
|
|
||||||
for ( int i = 0; i < xtions.length(); ++i )
|
for ( int i = 0; i < xtions.length(); ++i )
|
||||||
|
@ -80,7 +80,7 @@ void NFA_State::ClearMarks()
|
||||||
{
|
{
|
||||||
if ( mark )
|
if ( mark )
|
||||||
{
|
{
|
||||||
SetMark(0);
|
SetMark(nullptr);
|
||||||
for ( int i = 0; i < xtions.length(); ++i )
|
for ( int i = 0; i < xtions.length(); ++i )
|
||||||
xtions[i]->ClearMarks();
|
xtions[i]->ClearMarks();
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ NFA_state_list* NFA_State::EpsilonClosure()
|
||||||
|
|
||||||
// Clear out markers.
|
// Clear out markers.
|
||||||
for ( i = 0; i < states.length(); ++i )
|
for ( i = 0; i < states.length(); ++i )
|
||||||
states[i]->SetMark(0);
|
states[i]->SetMark(nullptr);
|
||||||
|
|
||||||
// Make it fit.
|
// Make it fit.
|
||||||
epsclosure->resize(0);
|
epsclosure->resize(0);
|
||||||
|
@ -262,7 +262,7 @@ void NFA_Machine::MakePositiveClosure()
|
||||||
|
|
||||||
void NFA_Machine::MakeRepl(int lower, int upper)
|
void NFA_Machine::MakeRepl(int lower, int upper)
|
||||||
{
|
{
|
||||||
NFA_Machine* dup = 0;
|
NFA_Machine* dup = nullptr;
|
||||||
if ( upper > lower || upper == NO_UPPER_BOUND )
|
if ( upper > lower || upper == NO_UPPER_BOUND )
|
||||||
dup = DuplicateMachine();
|
dup = DuplicateMachine();
|
||||||
|
|
||||||
|
|
|
@ -78,12 +78,12 @@ protected:
|
||||||
|
|
||||||
class EpsilonState : public NFA_State {
|
class EpsilonState : public NFA_State {
|
||||||
public:
|
public:
|
||||||
EpsilonState() : NFA_State(SYM_EPSILON, 0) { }
|
EpsilonState() : NFA_State(SYM_EPSILON, nullptr) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class NFA_Machine : public BroObj {
|
class NFA_Machine : public BroObj {
|
||||||
public:
|
public:
|
||||||
explicit NFA_Machine(NFA_State* first, NFA_State* final = 0);
|
explicit NFA_Machine(NFA_State* first, NFA_State* final = nullptr);
|
||||||
~NFA_Machine() override;
|
~NFA_Machine() override;
|
||||||
|
|
||||||
NFA_State* FirstState() const { return first_state; }
|
NFA_State* FirstState() const { return first_state; }
|
||||||
|
|
|
@ -115,7 +115,7 @@ RETSIGTYPE watchdog(int /* signo */)
|
||||||
if ( ! pkt_dumper || pkt_dumper->IsError() )
|
if ( ! pkt_dumper || pkt_dumper->IsError() )
|
||||||
{
|
{
|
||||||
reporter->Error("watchdog: can't open watchdog-pkt.pcap for writing");
|
reporter->Error("watchdog: can't open watchdog-pkt.pcap for writing");
|
||||||
pkt_dumper = 0;
|
pkt_dumper = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern void net_delete(); // Reclaim all memory, etc.
|
||||||
extern void net_update_time(double new_network_time);
|
extern void net_update_time(double new_network_time);
|
||||||
extern void net_packet_dispatch(double t, const Packet* pkt,
|
extern void net_packet_dispatch(double t, const Packet* pkt,
|
||||||
iosource::PktSrc* src_ps);
|
iosource::PktSrc* src_ps);
|
||||||
extern void expire_timers(iosource::PktSrc* src_ps = 0);
|
extern void expire_timers(iosource::PktSrc* src_ps = nullptr);
|
||||||
extern void zeek_terminate_loop(const char* reason);
|
extern void zeek_terminate_loop(const char* reason);
|
||||||
|
|
||||||
// Functions to temporarily suspend processing of live input (network packets
|
// Functions to temporarily suspend processing of live input (network packets
|
||||||
|
|
|
@ -165,7 +165,7 @@ void BroObj::DoMsg(ODesc* d, const char s1[], const BroObj* obj2,
|
||||||
d->Add(s1);
|
d->Add(s1);
|
||||||
PinPoint(d, obj2, pinpoint_only);
|
PinPoint(d, obj2, pinpoint_only);
|
||||||
|
|
||||||
const Location* loc2 = 0;
|
const Location* loc2 = nullptr;
|
||||||
if ( obj2 && obj2->GetLocationInfo() != &no_location &&
|
if ( obj2 && obj2->GetLocationInfo() != &no_location &&
|
||||||
*obj2->GetLocationInfo() != *GetLocationInfo() )
|
*obj2->GetLocationInfo() != *GetLocationInfo() )
|
||||||
loc2 = obj2->GetLocationInfo();
|
loc2 = obj2->GetLocationInfo();
|
||||||
|
|
20
src/Obj.h
20
src/Obj.h
|
@ -66,7 +66,7 @@ public:
|
||||||
// we check for whether start_location has a line number
|
// we check for whether start_location has a line number
|
||||||
// of 0, which should only happen if it's been assigned
|
// of 0, which should only happen if it's been assigned
|
||||||
// to no_location (or hasn't been initialized at all).
|
// to no_location (or hasn't been initialized at all).
|
||||||
location = 0;
|
location = nullptr;
|
||||||
if ( start_location.first_line != 0 )
|
if ( start_location.first_line != 0 )
|
||||||
SetLocationInfo(&start_location, &end_location);
|
SetLocationInfo(&start_location, &end_location);
|
||||||
}
|
}
|
||||||
|
@ -80,14 +80,14 @@ public:
|
||||||
// Report user warnings/errors. If obj2 is given, then it's
|
// Report user warnings/errors. If obj2 is given, then it's
|
||||||
// included in the message, though if pinpoint_only is non-zero,
|
// included in the message, though if pinpoint_only is non-zero,
|
||||||
// then obj2 is only used to pinpoint the location.
|
// then obj2 is only used to pinpoint the location.
|
||||||
void Warn(const char* msg, const BroObj* obj2 = 0,
|
void Warn(const char* msg, const BroObj* obj2 = nullptr,
|
||||||
bool pinpoint_only = false, const Location* expr_location = 0) const;
|
bool pinpoint_only = false, const Location* expr_location = nullptr) const;
|
||||||
void Error(const char* msg, const BroObj* obj2 = 0,
|
void Error(const char* msg, const BroObj* obj2 = nullptr,
|
||||||
bool pinpoint_only = false, const Location* expr_location = 0) const;
|
bool pinpoint_only = false, const Location* expr_location = nullptr) const;
|
||||||
|
|
||||||
// Report internal errors.
|
// Report internal errors.
|
||||||
void BadTag(const char* msg, const char* t1 = 0,
|
void BadTag(const char* msg, const char* t1 = nullptr,
|
||||||
const char* t2 = 0) const;
|
const char* t2 = nullptr) const;
|
||||||
#define CHECK_TAG(t1, t2, text, tag_to_text_func) \
|
#define CHECK_TAG(t1, t2, text, tag_to_text_func) \
|
||||||
{ \
|
{ \
|
||||||
if ( t1 != t2 ) \
|
if ( t1 != t2 ) \
|
||||||
|
@ -134,9 +134,9 @@ protected:
|
||||||
private:
|
private:
|
||||||
friend class SuppressErrors;
|
friend class SuppressErrors;
|
||||||
|
|
||||||
void DoMsg(ODesc* d, const char s1[], const BroObj* obj2 = 0,
|
void DoMsg(ODesc* d, const char s1[], const BroObj* obj2 = nullptr,
|
||||||
bool pinpoint_only = false, const Location* expr_location = 0) const;
|
bool pinpoint_only = false, const Location* expr_location = nullptr) const;
|
||||||
void PinPoint(ODesc* d, const BroObj* obj2 = 0,
|
void PinPoint(ODesc* d, const BroObj* obj2 = nullptr,
|
||||||
bool pinpoint_only = false) const;
|
bool pinpoint_only = false) const;
|
||||||
|
|
||||||
friend inline void Ref(BroObj* o);
|
friend inline void Ref(BroObj* o);
|
||||||
|
|
|
@ -699,24 +699,24 @@ bool EntropyVal::DoUnserialize(const broker::data& data)
|
||||||
BloomFilterVal::BloomFilterVal()
|
BloomFilterVal::BloomFilterVal()
|
||||||
: OpaqueVal(bloomfilter_type)
|
: OpaqueVal(bloomfilter_type)
|
||||||
{
|
{
|
||||||
type = 0;
|
type = nullptr;
|
||||||
hash = 0;
|
hash = nullptr;
|
||||||
bloom_filter = 0;
|
bloom_filter = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BloomFilterVal::BloomFilterVal(OpaqueType* t)
|
BloomFilterVal::BloomFilterVal(OpaqueType* t)
|
||||||
: OpaqueVal(t)
|
: OpaqueVal(t)
|
||||||
{
|
{
|
||||||
type = 0;
|
type = nullptr;
|
||||||
hash = 0;
|
hash = nullptr;
|
||||||
bloom_filter = 0;
|
bloom_filter = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BloomFilterVal::BloomFilterVal(probabilistic::BloomFilter* bf)
|
BloomFilterVal::BloomFilterVal(probabilistic::BloomFilter* bf)
|
||||||
: OpaqueVal(bloomfilter_type)
|
: OpaqueVal(bloomfilter_type)
|
||||||
{
|
{
|
||||||
type = 0;
|
type = nullptr;
|
||||||
hash = 0;
|
hash = nullptr;
|
||||||
bloom_filter = bf;
|
bloom_filter = bf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,13 +790,13 @@ IntrusivePtr<BloomFilterVal> BloomFilterVal::Merge(const BloomFilterVal* x,
|
||||||
! same_type(x->Type(), y->Type()) )
|
! same_type(x->Type(), y->Type()) )
|
||||||
{
|
{
|
||||||
reporter->Error("cannot merge Bloom filters with different types");
|
reporter->Error("cannot merge Bloom filters with different types");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( typeid(*x->bloom_filter) != typeid(*y->bloom_filter) )
|
if ( typeid(*x->bloom_filter) != typeid(*y->bloom_filter) )
|
||||||
{
|
{
|
||||||
reporter->Error("cannot merge different Bloom filter types");
|
reporter->Error("cannot merge different Bloom filter types");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
probabilistic::BloomFilter* copy = x->bloom_filter->Clone();
|
probabilistic::BloomFilter* copy = x->bloom_filter->Clone();
|
||||||
|
@ -805,7 +805,7 @@ IntrusivePtr<BloomFilterVal> BloomFilterVal::Merge(const BloomFilterVal* x,
|
||||||
{
|
{
|
||||||
delete copy;
|
delete copy;
|
||||||
reporter->Error("failed to merge Bloom filter");
|
reporter->Error("failed to merge Bloom filter");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto merged = make_intrusive<BloomFilterVal>(copy);
|
auto merged = make_intrusive<BloomFilterVal>(copy);
|
||||||
|
@ -813,7 +813,7 @@ IntrusivePtr<BloomFilterVal> BloomFilterVal::Merge(const BloomFilterVal* x,
|
||||||
if ( x->Type() && ! merged->Typify(x->Type()) )
|
if ( x->Type() && ! merged->Typify(x->Type()) )
|
||||||
{
|
{
|
||||||
reporter->Error("failed to set type on merged Bloom filter");
|
reporter->Error("failed to set type on merged Bloom filter");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return merged;
|
return merged;
|
||||||
|
@ -876,17 +876,17 @@ bool BloomFilterVal::DoUnserialize(const broker::data& data)
|
||||||
|
|
||||||
CardinalityVal::CardinalityVal() : OpaqueVal(cardinality_type)
|
CardinalityVal::CardinalityVal() : OpaqueVal(cardinality_type)
|
||||||
{
|
{
|
||||||
c = 0;
|
c = nullptr;
|
||||||
type = 0;
|
type = nullptr;
|
||||||
hash = 0;
|
hash = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardinalityVal::CardinalityVal(probabilistic::CardinalityCounter* arg_c)
|
CardinalityVal::CardinalityVal(probabilistic::CardinalityCounter* arg_c)
|
||||||
: OpaqueVal(cardinality_type)
|
: OpaqueVal(cardinality_type)
|
||||||
{
|
{
|
||||||
c = arg_c;
|
c = arg_c;
|
||||||
type = 0;
|
type = nullptr;
|
||||||
hash = 0;
|
hash = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardinalityVal::~CardinalityVal()
|
CardinalityVal::~CardinalityVal()
|
||||||
|
|
|
@ -186,49 +186,49 @@ zeek::Options zeek::parse_cmdline(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr struct option long_opts[] = {
|
constexpr struct option long_opts[] = {
|
||||||
{"parse-only", no_argument, 0, 'a'},
|
{"parse-only", no_argument, nullptr, 'a'},
|
||||||
{"bare-mode", no_argument, 0, 'b'},
|
{"bare-mode", no_argument, nullptr, 'b'},
|
||||||
{"debug-script", no_argument, 0, 'd'},
|
{"debug-script", no_argument, nullptr, 'd'},
|
||||||
{"exec", required_argument, 0, 'e'},
|
{"exec", required_argument, nullptr, 'e'},
|
||||||
{"filter", required_argument, 0, 'f'},
|
{"filter", required_argument, nullptr, 'f'},
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, nullptr, 'h'},
|
||||||
{"iface", required_argument, 0, 'i'},
|
{"iface", required_argument, nullptr, 'i'},
|
||||||
{"zeekygen", required_argument, 0, 'X'},
|
{"zeekygen", required_argument, nullptr, 'X'},
|
||||||
{"prefix", required_argument, 0, 'p'},
|
{"prefix", required_argument, nullptr, 'p'},
|
||||||
{"readfile", required_argument, 0, 'r'},
|
{"readfile", required_argument, nullptr, 'r'},
|
||||||
{"rulefile", required_argument, 0, 's'},
|
{"rulefile", required_argument, nullptr, 's'},
|
||||||
{"tracefile", required_argument, 0, 't'},
|
{"tracefile", required_argument, nullptr, 't'},
|
||||||
{"writefile", required_argument, 0, 'w'},
|
{"writefile", required_argument, nullptr, 'w'},
|
||||||
{"version", no_argument, 0, 'v'},
|
{"version", no_argument, nullptr, 'v'},
|
||||||
{"no-checksums", no_argument, 0, 'C'},
|
{"no-checksums", no_argument, nullptr, 'C'},
|
||||||
{"force-dns", no_argument, 0, 'F'},
|
{"force-dns", no_argument, nullptr, 'F'},
|
||||||
{"load-seeds", required_argument, 0, 'G'},
|
{"load-seeds", required_argument, nullptr, 'G'},
|
||||||
{"save-seeds", required_argument, 0, 'H'},
|
{"save-seeds", required_argument, nullptr, 'H'},
|
||||||
{"print-plugins", no_argument, 0, 'N'},
|
{"print-plugins", no_argument, nullptr, 'N'},
|
||||||
{"prime-dns", no_argument, 0, 'P'},
|
{"prime-dns", no_argument, nullptr, 'P'},
|
||||||
{"time", no_argument, 0, 'Q'},
|
{"time", no_argument, nullptr, 'Q'},
|
||||||
{"debug-rules", no_argument, 0, 'S'},
|
{"debug-rules", no_argument, nullptr, 'S'},
|
||||||
{"re-level", required_argument, 0, 'T'},
|
{"re-level", required_argument, nullptr, 'T'},
|
||||||
{"watchdog", no_argument, 0, 'W'},
|
{"watchdog", no_argument, nullptr, 'W'},
|
||||||
{"print-id", required_argument, 0, 'I'},
|
{"print-id", required_argument, nullptr, 'I'},
|
||||||
{"status-file", required_argument, 0, 'U'},
|
{"status-file", required_argument, nullptr, 'U'},
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{"debug", required_argument, 0, 'B'},
|
{"debug", required_argument, nullptr, 'B'},
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_IDMEF
|
#ifdef USE_IDMEF
|
||||||
{"idmef-dtd", required_argument, 0, 'n'},
|
{"idmef-dtd", required_argument, nullptr, 'n'},
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_PERFTOOLS_DEBUG
|
#ifdef USE_PERFTOOLS_DEBUG
|
||||||
{"mem-leaks", no_argument, 0, 'm'},
|
{"mem-leaks", no_argument, nullptr, 'm'},
|
||||||
{"mem-profile", no_argument, 0, 'M'},
|
{"mem-profile", no_argument, nullptr, 'M'},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{"pseudo-realtime", optional_argument, 0, 'E'},
|
{"pseudo-realtime", optional_argument, nullptr, 'E'},
|
||||||
{"jobs", optional_argument, 0, 'j'},
|
{"jobs", optional_argument, nullptr, 'j'},
|
||||||
{"test", no_argument, 0, '#'},
|
{"test", no_argument, nullptr, '#'},
|
||||||
|
|
||||||
{0, 0, 0, 0},
|
{nullptr, 0, nullptr, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
char opts[256];
|
char opts[256];
|
||||||
|
|
|
@ -18,8 +18,8 @@ using namespace std;
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
|
|
||||||
struct PolicyFile {
|
struct PolicyFile {
|
||||||
PolicyFile () { filedata = 0; lmtime = 0; }
|
PolicyFile () { filedata = nullptr; lmtime = 0; }
|
||||||
~PolicyFile () { delete [] filedata; filedata = 0; }
|
~PolicyFile () { delete [] filedata; filedata = nullptr; }
|
||||||
|
|
||||||
time_t lmtime;
|
time_t lmtime;
|
||||||
char* filedata;
|
char* filedata;
|
||||||
|
|
|
@ -28,7 +28,7 @@ void* PrefixTable::Insert(const IPAddr& addr, int width, void* data)
|
||||||
if ( ! node )
|
if ( ! node )
|
||||||
{
|
{
|
||||||
reporter->InternalWarning("Cannot create node in patricia tree");
|
reporter->InternalWarning("Cannot create node in patricia tree");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* old = node->data;
|
void* old = node->data;
|
||||||
|
@ -59,7 +59,7 @@ void* PrefixTable::Insert(const Val* value, void* data)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalWarning("Wrong index type for PrefixTable");
|
reporter->InternalWarning("Wrong index type for PrefixTable");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ void* PrefixTable::Lookup(const IPAddr& addr, int width, bool exact) const
|
||||||
patricia_node_t** list = nullptr;
|
patricia_node_t** list = nullptr;
|
||||||
|
|
||||||
Deref_Prefix(prefix);
|
Deref_Prefix(prefix);
|
||||||
return node ? node->data : 0;
|
return node ? node->data : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* PrefixTable::Lookup(const Val* value, bool exact) const
|
void* PrefixTable::Lookup(const Val* value, bool exact) const
|
||||||
|
@ -120,7 +120,7 @@ void* PrefixTable::Lookup(const Val* value, bool exact) const
|
||||||
default:
|
default:
|
||||||
reporter->InternalWarning("Wrong index type %d for PrefixTable",
|
reporter->InternalWarning("Wrong index type %d for PrefixTable",
|
||||||
value->Type()->Tag());
|
value->Type()->Tag());
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ void* PrefixTable::Remove(const IPAddr& addr, int width)
|
||||||
Deref_Prefix(prefix);
|
Deref_Prefix(prefix);
|
||||||
|
|
||||||
if ( ! node )
|
if ( ! node )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
void* old = node->data;
|
void* old = node->data;
|
||||||
patricia_remove(tree, node);
|
patricia_remove(tree, node);
|
||||||
|
@ -158,7 +158,7 @@ void* PrefixTable::Remove(const Val* value)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalWarning("Wrong index type for PrefixTable");
|
reporter->InternalWarning("Wrong index type for PrefixTable");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ PrefixTable::iterator PrefixTable::InitIterator()
|
||||||
iterator i;
|
iterator i;
|
||||||
i.Xsp = i.Xstack;
|
i.Xsp = i.Xstack;
|
||||||
i.Xrn = tree->head;
|
i.Xrn = tree->head;
|
||||||
i.Xnode = 0;
|
i.Xnode = nullptr;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ void* PrefixTable::GetNext(iterator* i)
|
||||||
{
|
{
|
||||||
i->Xnode = i->Xrn;
|
i->Xnode = i->Xrn;
|
||||||
if ( ! i->Xnode )
|
if ( ! i->Xnode )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( i->Xrn->l )
|
if ( i->Xrn->l )
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,7 @@ void* PrefixTable::GetNext(iterator* i)
|
||||||
i->Xrn = *(--i->Xsp);
|
i->Xrn = *(--i->Xsp);
|
||||||
|
|
||||||
else
|
else
|
||||||
i->Xrn = (patricia_node_t*) 0;
|
i->Xrn = (patricia_node_t*) nullptr;
|
||||||
|
|
||||||
if ( i->Xnode->prefix )
|
if ( i->Xnode->prefix )
|
||||||
return (void*) i->Xnode->data;
|
return (void*) i->Xnode->data;
|
||||||
|
|
|
@ -30,10 +30,10 @@ public:
|
||||||
// Addr in network byte order. If data is zero, acts like a set.
|
// Addr in network byte order. If data is zero, acts like a set.
|
||||||
// Returns ptr to old data if already existing.
|
// Returns ptr to old data if already existing.
|
||||||
// For existing items without data, returns non-nil if found.
|
// For existing items without data, returns non-nil if found.
|
||||||
void* Insert(const IPAddr& addr, int width, void* data = 0);
|
void* Insert(const IPAddr& addr, int width, void* data = nullptr);
|
||||||
|
|
||||||
// Value may be addr or subnet.
|
// Value may be addr or subnet.
|
||||||
void* Insert(const Val* value, void* data = 0);
|
void* Insert(const Val* value, void* data = nullptr);
|
||||||
|
|
||||||
// Returns nil if not found, pointer to data otherwise.
|
// Returns nil if not found, pointer to data otherwise.
|
||||||
// For items without data, returns non-nil if found.
|
// For items without data, returns non-nil if found.
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
PQ_Element* Top() const
|
PQ_Element* Top() const
|
||||||
{
|
{
|
||||||
if ( heap_size == 0 )
|
if ( heap_size == 0 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return heap[0];
|
return heap[0];
|
||||||
}
|
}
|
||||||
|
|
24
src/RE.cc
24
src/RE.cc
|
@ -12,10 +12,10 @@
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "BroString.h"
|
#include "BroString.h"
|
||||||
|
|
||||||
CCL* curr_ccl = 0;
|
CCL* curr_ccl = nullptr;
|
||||||
|
|
||||||
Specific_RE_Matcher* rem;
|
Specific_RE_Matcher* rem;
|
||||||
NFA_Machine* nfa = 0;
|
NFA_Machine* nfa = nullptr;
|
||||||
int case_insensitive = 0;
|
int case_insensitive = 0;
|
||||||
|
|
||||||
extern int RE_parse(void);
|
extern int RE_parse(void);
|
||||||
|
@ -27,10 +27,10 @@ Specific_RE_Matcher::Specific_RE_Matcher(match_type arg_mt, int arg_multiline)
|
||||||
{
|
{
|
||||||
mt = arg_mt;
|
mt = arg_mt;
|
||||||
multiline = arg_multiline;
|
multiline = arg_multiline;
|
||||||
any_ccl = 0;
|
any_ccl = nullptr;
|
||||||
pattern_text = 0;
|
pattern_text = nullptr;
|
||||||
dfa = 0;
|
dfa = nullptr;
|
||||||
ecs = 0;
|
ecs = nullptr;
|
||||||
accepted = new AcceptingSet();
|
accepted = new AcceptingSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ bool Specific_RE_Matcher::Compile(bool lazy)
|
||||||
{
|
{
|
||||||
reporter->Error("error compiling pattern /%s/", pattern_text);
|
reporter->Error("error compiling pattern /%s/", pattern_text);
|
||||||
Unref(nfa);
|
Unref(nfa);
|
||||||
nfa = 0;
|
nfa = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ bool Specific_RE_Matcher::Compile(bool lazy)
|
||||||
dfa = new DFA_Machine(nfa, EC());
|
dfa = new DFA_Machine(nfa, EC());
|
||||||
|
|
||||||
Unref(nfa);
|
Unref(nfa);
|
||||||
nfa = 0;
|
nfa = nullptr;
|
||||||
|
|
||||||
ecs = EC()->EquivClasses();
|
ecs = EC()->EquivClasses();
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ bool Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx
|
||||||
|
|
||||||
rem = this;
|
rem = this;
|
||||||
|
|
||||||
NFA_Machine* set_nfa = 0;
|
NFA_Machine* set_nfa = nullptr;
|
||||||
|
|
||||||
loop_over_list(set, i)
|
loop_over_list(set, i)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,7 @@ bool Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx
|
||||||
else
|
else
|
||||||
Unref(nfa);
|
Unref(nfa);
|
||||||
|
|
||||||
nfa = 0;
|
nfa = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ bool Specific_RE_Matcher::MatchAll(const u_char* bv, int n)
|
||||||
if ( d )
|
if ( d )
|
||||||
d = d->Xtion(ecs[SYM_EOL], dfa);
|
d = d->Xtion(ecs[SYM_EOL], dfa);
|
||||||
|
|
||||||
return d && d->Accept() != 0;
|
return d && d->Accept() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ bool RE_Match_State::Match(const u_char* bv, int n,
|
||||||
|
|
||||||
if ( ! next_state )
|
if ( ! next_state )
|
||||||
{
|
{
|
||||||
current_state = 0;
|
current_state = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
src/RE.h
6
src/RE.h
|
@ -140,10 +140,10 @@ class RE_Match_State {
|
||||||
public:
|
public:
|
||||||
explicit RE_Match_State(Specific_RE_Matcher* matcher)
|
explicit RE_Match_State(Specific_RE_Matcher* matcher)
|
||||||
{
|
{
|
||||||
dfa = matcher->DFA() ? matcher->DFA() : 0;
|
dfa = matcher->DFA() ? matcher->DFA() : nullptr;
|
||||||
ecs = matcher->EC()->EquivClasses();
|
ecs = matcher->EC()->EquivClasses();
|
||||||
current_pos = -1;
|
current_pos = -1;
|
||||||
current_state = 0;
|
current_state = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AcceptingMatchSet& AcceptedMatches() const
|
const AcceptingMatchSet& AcceptedMatches() const
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
current_pos = -1;
|
current_pos = -1;
|
||||||
current_state = 0;
|
current_state = nullptr;
|
||||||
accepted_matches.clear();
|
accepted_matches.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ int closelog();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Reporter* reporter = 0;
|
Reporter* reporter = nullptr;
|
||||||
|
|
||||||
Reporter::Reporter()
|
Reporter::Reporter()
|
||||||
{
|
{
|
||||||
|
@ -88,8 +88,8 @@ void Reporter::Info(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
FILE* out = EmitToStderr(info_to_stderr) ? stderr : 0;
|
FILE* out = EmitToStderr(info_to_stderr) ? stderr : nullptr;
|
||||||
DoLog("", reporter_info, out, 0, 0, true, true, 0, fmt, ap);
|
DoLog("", reporter_info, out, nullptr, nullptr, true, true, nullptr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ void Reporter::Warning(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : 0;
|
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : nullptr;
|
||||||
DoLog("warning", reporter_warning, out, 0, 0, true, true, 0, fmt, ap);
|
DoLog("warning", reporter_warning, out, nullptr, nullptr, true, true, nullptr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ void Reporter::Error(const char* fmt, ...)
|
||||||
++errors;
|
++errors;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : 0;
|
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : nullptr;
|
||||||
DoLog("error", reporter_error, out, 0, 0, true, true, 0, fmt, ap);
|
DoLog("error", reporter_error, out, nullptr, nullptr, true, true, nullptr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void Reporter::FatalError(const char* fmt, ...)
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
// Always log to stderr.
|
// Always log to stderr.
|
||||||
DoLog("fatal error", 0, stderr, 0, 0, true, false, 0, fmt, ap);
|
DoLog("fatal error", nullptr, stderr, nullptr, nullptr, true, false, nullptr, fmt, ap);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ void Reporter::FatalErrorWithCore(const char* fmt, ...)
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
// Always log to stderr.
|
// Always log to stderr.
|
||||||
DoLog("fatal error", 0, stderr, 0, 0, true, false, 0, fmt, ap);
|
DoLog("fatal error", nullptr, stderr, nullptr, nullptr, true, false, nullptr, fmt, ap);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ void Reporter::ExprRuntimeError(const Expr* expr, const char* fmt, ...)
|
||||||
PushLocation(expr->GetLocationInfo());
|
PushLocation(expr->GetLocationInfo());
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : 0;
|
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : nullptr;
|
||||||
DoLog("expression error", reporter_error, out, 0, 0, true, true,
|
DoLog("expression error", reporter_error, out, nullptr, nullptr, true, true,
|
||||||
d.Description(), fmt, ap);
|
d.Description(), fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
PopLocation();
|
PopLocation();
|
||||||
|
@ -166,8 +166,8 @@ void Reporter::RuntimeError(const Location* location, const char* fmt, ...)
|
||||||
PushLocation(location);
|
PushLocation(location);
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : 0;
|
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : nullptr;
|
||||||
DoLog("runtime error", reporter_error, out, 0, 0, true, true, "", fmt, ap);
|
DoLog("runtime error", reporter_error, out, nullptr, nullptr, true, true, "", fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
PopLocation();
|
PopLocation();
|
||||||
throw InterpreterException();
|
throw InterpreterException();
|
||||||
|
@ -179,7 +179,7 @@ void Reporter::InternalError(const char* fmt, ...)
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
// Always log to stderr.
|
// Always log to stderr.
|
||||||
DoLog("internal error", 0, stderr, 0, 0, true, false, 0, fmt, ap);
|
DoLog("internal error", nullptr, stderr, nullptr, nullptr, true, false, nullptr, fmt, ap);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void Reporter::AnalyzerError(analyzer::Analyzer* a, const char* fmt,
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
// Always log to stderr.
|
// Always log to stderr.
|
||||||
// TODO: would be nice to also log a call stack.
|
// TODO: would be nice to also log a call stack.
|
||||||
DoLog("analyzer error", reporter_error, stderr, 0, 0, true, true, 0, fmt,
|
DoLog("analyzer error", reporter_error, stderr, nullptr, nullptr, true, true, nullptr, fmt,
|
||||||
ap);
|
ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
@ -206,9 +206,9 @@ void Reporter::InternalWarning(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : 0;
|
FILE* out = EmitToStderr(warnings_to_stderr) ? stderr : nullptr;
|
||||||
// TODO: would be nice to also log a call stack.
|
// TODO: would be nice to also log a call stack.
|
||||||
DoLog("internal warning", reporter_warning, out, 0, 0, true, true, 0, fmt,
|
DoLog("internal warning", reporter_warning, out, nullptr, nullptr, true, true, nullptr, fmt,
|
||||||
ap);
|
ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ void Reporter::WeirdHelper(EventHandlerPtr event, val_list vl, const char* fmt_n
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt_name);
|
va_start(ap, fmt_name);
|
||||||
DoLog("weird", event, 0, 0, &vl, false, false, 0, fmt_name, ap);
|
DoLog("weird", event, nullptr, nullptr, &vl, false, false, nullptr, fmt_name, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out,
|
||||||
|
|
||||||
int size = sizeof(tmp);
|
int size = sizeof(tmp);
|
||||||
char* buffer = tmp;
|
char* buffer = tmp;
|
||||||
char* alloced = 0;
|
char* alloced = nullptr;
|
||||||
|
|
||||||
string loc_str;
|
string loc_str;
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ void Rule::AddRequires(const char* id, bool opposite_direction, bool negate)
|
||||||
{
|
{
|
||||||
Precond* p = new Precond;
|
Precond* p = new Precond;
|
||||||
p->id = copy_string(id);
|
p->id = copy_string(id);
|
||||||
p->rule = 0;
|
p->rule = nullptr;
|
||||||
p->opposite_dir = opposite_direction;
|
p->opposite_dir = opposite_direction;
|
||||||
p->negate = negate;
|
p->negate = negate;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
idx = rule_counter++;
|
idx = rule_counter++;
|
||||||
location = arg_location;
|
location = arg_location;
|
||||||
active = true;
|
active = true;
|
||||||
next = 0;
|
next = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Rule();
|
~Rule();
|
||||||
|
|
|
@ -48,10 +48,10 @@ RuleHdrTest::RuleHdrTest(Prot arg_prot, uint32_t arg_offset, uint32_t arg_size,
|
||||||
size = arg_size;
|
size = arg_size;
|
||||||
comp = arg_comp;
|
comp = arg_comp;
|
||||||
vals = arg_vals;
|
vals = arg_vals;
|
||||||
sibling = 0;
|
sibling = nullptr;
|
||||||
child = 0;
|
child = nullptr;
|
||||||
pattern_rules = 0;
|
pattern_rules = nullptr;
|
||||||
pure_rules = 0;
|
pure_rules = nullptr;
|
||||||
ruleset = new IntSet;
|
ruleset = new IntSet;
|
||||||
id = ++idcounter;
|
id = ++idcounter;
|
||||||
level = 0;
|
level = 0;
|
||||||
|
@ -65,10 +65,10 @@ RuleHdrTest::RuleHdrTest(Prot arg_prot, Comp arg_comp, vector<IPPrefix> arg_v)
|
||||||
comp = arg_comp;
|
comp = arg_comp;
|
||||||
vals = new maskedvalue_list;
|
vals = new maskedvalue_list;
|
||||||
prefix_vals = std::move(arg_v);
|
prefix_vals = std::move(arg_v);
|
||||||
sibling = 0;
|
sibling = nullptr;
|
||||||
child = 0;
|
child = nullptr;
|
||||||
pattern_rules = 0;
|
pattern_rules = nullptr;
|
||||||
pure_rules = 0;
|
pure_rules = nullptr;
|
||||||
ruleset = new IntSet;
|
ruleset = new IntSet;
|
||||||
id = ++idcounter;
|
id = ++idcounter;
|
||||||
level = 0;
|
level = 0;
|
||||||
|
@ -103,7 +103,7 @@ RuleHdrTest::RuleHdrTest(RuleHdrTest& h)
|
||||||
for ( PatternSet* orig_set : h.psets[j] )
|
for ( PatternSet* orig_set : h.psets[j] )
|
||||||
{
|
{
|
||||||
PatternSet* copied_set = new PatternSet;
|
PatternSet* copied_set = new PatternSet;
|
||||||
copied_set->re = 0;
|
copied_set->re = nullptr;
|
||||||
copied_set->ids = orig_set->ids;
|
copied_set->ids = orig_set->ids;
|
||||||
for ( const auto& pattern : orig_set->patterns )
|
for ( const auto& pattern : orig_set->patterns )
|
||||||
copied_set->patterns.push_back(copy_string(pattern));
|
copied_set->patterns.push_back(copy_string(pattern));
|
||||||
|
@ -113,10 +113,10 @@ RuleHdrTest::RuleHdrTest(RuleHdrTest& h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sibling = 0;
|
sibling = nullptr;
|
||||||
child = 0;
|
child = nullptr;
|
||||||
pattern_rules = 0;
|
pattern_rules = nullptr;
|
||||||
pure_rules = 0;
|
pure_rules = nullptr;
|
||||||
ruleset = new IntSet;
|
ruleset = new IntSet;
|
||||||
id = ++idcounter;
|
id = ++idcounter;
|
||||||
level = 0;
|
level = 0;
|
||||||
|
@ -758,8 +758,8 @@ RuleEndpointState* RuleMatcher::InitEndpoint(analyzer::Analyzer* analyzer,
|
||||||
// Evaluate all rules on this node which don't contain
|
// Evaluate all rules on this node which don't contain
|
||||||
// any patterns.
|
// any patterns.
|
||||||
for ( Rule* r = hdr_test->pure_rules; r; r = r->next )
|
for ( Rule* r = hdr_test->pure_rules; r; r = r->next )
|
||||||
if ( EvalRuleConditions(r, state, 0, 0, false) )
|
if ( EvalRuleConditions(r, state, nullptr, 0, false) )
|
||||||
ExecRuleActions(r, state, 0, 0, false);
|
ExecRuleActions(r, state, nullptr, 0, false);
|
||||||
|
|
||||||
// If we're on or above the RE_level, we may have some
|
// If we're on or above the RE_level, we may have some
|
||||||
// pattern matching to do.
|
// pattern matching to do.
|
||||||
|
@ -989,7 +989,7 @@ void RuleMatcher::ExecPureRules(RuleEndpointState* state, bool eos)
|
||||||
for ( const auto& hdr_test : state->hdr_tests )
|
for ( const auto& hdr_test : state->hdr_tests )
|
||||||
{
|
{
|
||||||
for ( Rule* r = hdr_test->pure_rules; r; r = r->next )
|
for ( Rule* r = hdr_test->pure_rules; r; r = r->next )
|
||||||
ExecRulePurely(r, 0, state, eos);
|
ExecRulePurely(r, nullptr, state, eos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,14 +1001,14 @@ bool RuleMatcher::ExecRulePurely(Rule* r, BroString* s,
|
||||||
|
|
||||||
DBG_LOG(DBG_RULES, "Checking rule %s purely", r->ID());
|
DBG_LOG(DBG_RULES, "Checking rule %s purely", r->ID());
|
||||||
|
|
||||||
if ( EvalRuleConditions(r, state, 0, 0, eos) )
|
if ( EvalRuleConditions(r, state, nullptr, 0, eos) )
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_RULES, "MATCH!");
|
DBG_LOG(DBG_RULES, "MATCH!");
|
||||||
|
|
||||||
if ( s )
|
if ( s )
|
||||||
ExecRuleActions(r, state, s->Bytes(), s->Len(), eos);
|
ExecRuleActions(r, state, s->Bytes(), s->Len(), eos);
|
||||||
else
|
else
|
||||||
ExecRuleActions(r, state, 0, 0, eos);
|
ExecRuleActions(r, state, nullptr, 0, eos);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1098,7 +1098,7 @@ void RuleMatcher::ExecRule(Rule* rule, RuleEndpointState* state, bool eos)
|
||||||
for ( Rule* r = h->pure_rules; r; r = r->next )
|
for ( Rule* r = h->pure_rules; r; r = r->next )
|
||||||
if ( r == rule )
|
if ( r == rule )
|
||||||
{ // found, so let's evaluate it
|
{ // found, so let's evaluate it
|
||||||
ExecRulePurely(rule, 0, state, eos);
|
ExecRulePurely(rule, nullptr, state, eos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,7 +1273,7 @@ static Val* get_bro_val(const char* label)
|
||||||
if ( ! id )
|
if ( ! id )
|
||||||
{
|
{
|
||||||
rules_error("unknown script-level identifier", label);
|
rules_error("unknown script-level identifier", label);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return id->ID_Val();
|
return id->ID_Val();
|
||||||
|
@ -1464,7 +1464,7 @@ void RuleMatcherState::FinishEndpointMatcher()
|
||||||
delete orig_match_state;
|
delete orig_match_state;
|
||||||
delete resp_match_state;
|
delete resp_match_state;
|
||||||
|
|
||||||
orig_match_state = resp_match_state = 0;
|
orig_match_state = resp_match_state = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RuleMatcherState::Match(Rule::PatternType type, const u_char* data,
|
void RuleMatcherState::Match(Rule::PatternType type, const u_char* data,
|
||||||
|
|
|
@ -67,7 +67,7 @@ typedef PList<BroString> bstr_list;
|
||||||
|
|
||||||
// Get values from Bro's script-level variables.
|
// Get values from Bro's script-level variables.
|
||||||
extern void id_to_maskedvallist(const char* id, maskedvalue_list* append_to,
|
extern void id_to_maskedvallist(const char* id, maskedvalue_list* append_to,
|
||||||
vector<IPPrefix>* prefix_vector = 0);
|
vector<IPPrefix>* prefix_vector = nullptr);
|
||||||
extern char* id_to_str(const char* id);
|
extern char* id_to_str(const char* id);
|
||||||
extern uint32_t id_to_uint(const char* id);
|
extern uint32_t id_to_uint(const char* id);
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public:
|
||||||
* @return The results of the signature matching.
|
* @return The results of the signature matching.
|
||||||
*/
|
*/
|
||||||
MIME_Matches* Match(RuleFileMagicState* state, const u_char* data,
|
MIME_Matches* Match(RuleFileMagicState* state, const u_char* data,
|
||||||
uint64_t len, MIME_Matches* matches = 0) const;
|
uint64_t len, MIME_Matches* matches = nullptr) const;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,7 +313,7 @@ public:
|
||||||
Val* BuildRuleStateValue(const Rule* rule,
|
Val* BuildRuleStateValue(const Rule* rule,
|
||||||
const RuleEndpointState* state) const;
|
const RuleEndpointState* state) const;
|
||||||
|
|
||||||
void GetStats(Stats* stats, RuleHdrTest* hdr_test = 0);
|
void GetStats(Stats* stats, RuleHdrTest* hdr_test = nullptr);
|
||||||
void DumpStats(BroFile* f);
|
void DumpStats(BroFile* f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -373,13 +373,13 @@ private:
|
||||||
// Keeps bi-directional matching-state.
|
// Keeps bi-directional matching-state.
|
||||||
class RuleMatcherState {
|
class RuleMatcherState {
|
||||||
public:
|
public:
|
||||||
RuleMatcherState() { orig_match_state = resp_match_state = 0; }
|
RuleMatcherState() { orig_match_state = resp_match_state = nullptr; }
|
||||||
~RuleMatcherState()
|
~RuleMatcherState()
|
||||||
{ delete orig_match_state; delete resp_match_state; }
|
{ delete orig_match_state; delete resp_match_state; }
|
||||||
|
|
||||||
// ip may be nil.
|
// ip may be nil.
|
||||||
void InitEndpointMatcher(analyzer::Analyzer* analyzer, const IP_Hdr* ip,
|
void InitEndpointMatcher(analyzer::Analyzer* analyzer, const IP_Hdr* ip,
|
||||||
int caplen, bool from_orig, analyzer::pia::PIA* pia = 0);
|
int caplen, bool from_orig, analyzer::pia::PIA* pia = nullptr);
|
||||||
|
|
||||||
// bol/eol should be set to false for type Rule::PAYLOAD; they're
|
// bol/eol should be set to false for type Rule::PAYLOAD; they're
|
||||||
// deduced automatically.
|
// deduced automatically.
|
||||||
|
|
10
src/Scope.cc
10
src/Scope.cc
|
@ -20,7 +20,7 @@ Scope::Scope(IntrusivePtr<ID> id, attr_list* al)
|
||||||
: scope_id(std::move(id))
|
: scope_id(std::move(id))
|
||||||
{
|
{
|
||||||
attrs = al;
|
attrs = al;
|
||||||
return_type = 0;
|
return_type = nullptr;
|
||||||
|
|
||||||
inits = new id_list;
|
inits = new id_list;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ ID* Scope::GenerateTemporary(const char* name)
|
||||||
id_list* Scope::GetInits()
|
id_list* Scope::GetInits()
|
||||||
{
|
{
|
||||||
id_list* ids = inits;
|
id_list* ids = inits;
|
||||||
inits = 0;
|
inits = nullptr;
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ void Scope::Describe(ODesc* d) const
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->Add(scope_id != 0);
|
d->Add(scope_id != nullptr);
|
||||||
d->SP();
|
d->SP();
|
||||||
d->Add(return_type != 0);
|
d->Add(return_type != nullptr);
|
||||||
d->SP();
|
d->SP();
|
||||||
d->Add(static_cast<uint64_t>(local.size()));
|
d->Add(static_cast<uint64_t>(local.size()));
|
||||||
d->SP();
|
d->SP();
|
||||||
|
@ -149,7 +149,7 @@ IntrusivePtr<ID> lookup_ID(const char* name, const char* curr_module,
|
||||||
return {NewRef{}, id};
|
return {NewRef{}, id};
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
|
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
|
||||||
|
|
|
@ -29,7 +29,7 @@ void SerializationFormat::StartRead(const char* data, uint32_t arg_len)
|
||||||
|
|
||||||
void SerializationFormat::EndRead()
|
void SerializationFormat::EndRead()
|
||||||
{
|
{
|
||||||
input = 0;
|
input = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerializationFormat::StartWrite()
|
void SerializationFormat::StartWrite()
|
||||||
|
@ -37,7 +37,7 @@ void SerializationFormat::StartWrite()
|
||||||
if ( output && output_size > INITIAL_SIZE )
|
if ( output && output_size > INITIAL_SIZE )
|
||||||
{
|
{
|
||||||
free(output);
|
free(output);
|
||||||
output = 0;
|
output = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! output )
|
if ( ! output )
|
||||||
|
@ -54,7 +54,7 @@ uint32_t SerializationFormat::EndWrite(char** data)
|
||||||
{
|
{
|
||||||
uint32_t rval = output_pos;
|
uint32_t rval = output_pos;
|
||||||
*data = output;
|
*data = output;
|
||||||
output = 0;
|
output = nullptr;
|
||||||
output_size = 0;
|
output_size = 0;
|
||||||
output_pos = 0;
|
output_pos = 0;
|
||||||
return rval;
|
return rval;
|
||||||
|
@ -193,7 +193,7 @@ bool BinarySerializationFormat::Read(char** str, int* len, const char* tag)
|
||||||
if ( ! ReadData(s, l) )
|
if ( ! ReadData(s, l) )
|
||||||
{
|
{
|
||||||
delete [] s;
|
delete [] s;
|
||||||
*str = 0;
|
*str = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,16 +68,16 @@ NetSessions::NetSessions()
|
||||||
if ( stp_correlate_pair )
|
if ( stp_correlate_pair )
|
||||||
stp_manager = new analyzer::stepping_stone::SteppingStoneManager();
|
stp_manager = new analyzer::stepping_stone::SteppingStoneManager();
|
||||||
else
|
else
|
||||||
stp_manager = 0;
|
stp_manager = nullptr;
|
||||||
|
|
||||||
discarder = new Discarder();
|
discarder = new Discarder();
|
||||||
if ( ! discarder->IsActive() )
|
if ( ! discarder->IsActive() )
|
||||||
{
|
{
|
||||||
delete discarder;
|
delete discarder;
|
||||||
discarder = 0;
|
discarder = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
packet_filter = 0;
|
packet_filter = nullptr;
|
||||||
|
|
||||||
dump_this_packet = false;
|
dump_this_packet = false;
|
||||||
num_packets_processed = 0;
|
num_packets_processed = 0;
|
||||||
|
@ -86,12 +86,12 @@ NetSessions::NetSessions()
|
||||||
pkt_profiler = new PacketProfiler(pkt_profile_mode,
|
pkt_profiler = new PacketProfiler(pkt_profile_mode,
|
||||||
pkt_profile_freq, pkt_profile_file->AsFile());
|
pkt_profile_freq, pkt_profile_file->AsFile());
|
||||||
else
|
else
|
||||||
pkt_profiler = 0;
|
pkt_profiler = nullptr;
|
||||||
|
|
||||||
if ( arp_request || arp_reply || bad_arp )
|
if ( arp_request || arp_reply || bad_arp )
|
||||||
arp_analyzer = new analyzer::arp::ARP_Analyzer();
|
arp_analyzer = new analyzer::arp::ARP_Analyzer();
|
||||||
else
|
else
|
||||||
arp_analyzer = 0;
|
arp_analyzer = nullptr;
|
||||||
|
|
||||||
memset(&stats, 0, sizeof(SessionStats));
|
memset(&stats, 0, sizeof(SessionStats));
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ void NetSessions::NextPacket(double t, const Packet* pkt)
|
||||||
|
|
||||||
const struct ip* ip = (const struct ip*) (pkt->data + pkt->hdr_size);
|
const struct ip* ip = (const struct ip*) (pkt->data + pkt->hdr_size);
|
||||||
IP_Hdr ip_hdr(ip, false);
|
IP_Hdr ip_hdr(ip, false);
|
||||||
DoNextPacket(t, pkt, &ip_hdr, 0);
|
DoNextPacket(t, pkt, &ip_hdr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( pkt->l3_proto == L3_IPV6 )
|
else if ( pkt->l3_proto == L3_IPV6 )
|
||||||
|
@ -165,7 +165,7 @@ void NetSessions::NextPacket(double t, const Packet* pkt)
|
||||||
}
|
}
|
||||||
|
|
||||||
IP_Hdr ip_hdr((const struct ip6_hdr*) (pkt->data + pkt->hdr_size), false, caplen);
|
IP_Hdr ip_hdr((const struct ip6_hdr*) (pkt->data + pkt->hdr_size), false, caplen);
|
||||||
DoNextPacket(t, pkt, &ip_hdr, 0);
|
DoNextPacket(t, pkt, &ip_hdr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( pkt->l3_proto == L3_ARP )
|
else if ( pkt->l3_proto == L3_ARP )
|
||||||
|
@ -261,7 +261,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
||||||
if ( discarder && discarder->NextPacket(ip_hdr, len, caplen) )
|
if ( discarder && discarder->NextPacket(ip_hdr, len, caplen) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FragReassembler* f = 0;
|
FragReassembler* f = nullptr;
|
||||||
|
|
||||||
if ( ip_hdr->IsFragment() )
|
if ( ip_hdr->IsFragment() )
|
||||||
{
|
{
|
||||||
|
@ -574,7 +574,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IP_Hdr* inner = 0;
|
IP_Hdr* inner = nullptr;
|
||||||
|
|
||||||
if ( gre_version != 0 )
|
if ( gre_version != 0 )
|
||||||
{
|
{
|
||||||
|
@ -662,7 +662,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
||||||
// We already know that connection.
|
// We already know that connection.
|
||||||
if ( conn->IsReuse(t, data) )
|
if ( conn->IsReuse(t, data) )
|
||||||
{
|
{
|
||||||
conn->Event(connection_reused, 0);
|
conn->Event(connection_reused, nullptr);
|
||||||
|
|
||||||
Remove(conn);
|
Remove(conn);
|
||||||
conn = NewConn(key, t, &id, data, proto, ip_hdr->FlowLabel(), pkt, encapsulation);
|
conn = NewConn(key, t, &id, data, proto, ip_hdr->FlowLabel(), pkt, encapsulation);
|
||||||
|
@ -686,16 +686,16 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
||||||
|
|
||||||
conn->CheckFlowLabel(is_orig, ip_hdr->FlowLabel());
|
conn->CheckFlowLabel(is_orig, ip_hdr->FlowLabel());
|
||||||
|
|
||||||
Val* pkt_hdr_val = 0;
|
Val* pkt_hdr_val = nullptr;
|
||||||
|
|
||||||
if ( ipv6_ext_headers && ip_hdr->NumHeaders() > 1 )
|
if ( ipv6_ext_headers && ip_hdr->NumHeaders() > 1 )
|
||||||
{
|
{
|
||||||
pkt_hdr_val = ip_hdr->BuildPktHdrVal();
|
pkt_hdr_val = ip_hdr->BuildPktHdrVal();
|
||||||
conn->Event(ipv6_ext_headers, 0, pkt_hdr_val);
|
conn->Event(ipv6_ext_headers, nullptr, pkt_hdr_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( new_packet )
|
if ( new_packet )
|
||||||
conn->Event(new_packet, 0,
|
conn->Event(new_packet, nullptr,
|
||||||
pkt_hdr_val ? pkt_hdr_val->Ref() : ip_hdr->BuildPktHdrVal());
|
pkt_hdr_val ? pkt_hdr_val->Ref() : ip_hdr->BuildPktHdrVal());
|
||||||
|
|
||||||
conn->NextPacket(t, is_orig, ip_hdr, len, caplen, data,
|
conn->NextPacket(t, is_orig, ip_hdr, len, caplen, data,
|
||||||
|
@ -739,7 +739,7 @@ void NetSessions::DoNextInnerPacket(double t, const Packet* pkt,
|
||||||
((network_time - (double)ts.tv_sec) * 1000000);
|
((network_time - (double)ts.tv_sec) * 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u_char* data = 0;
|
const u_char* data = nullptr;
|
||||||
|
|
||||||
if ( inner->IP4_Hdr() )
|
if ( inner->IP4_Hdr() )
|
||||||
data = (const u_char*) inner->IP4_Hdr();
|
data = (const u_char*) inner->IP4_Hdr();
|
||||||
|
@ -906,7 +906,7 @@ Connection* NetSessions::FindConnection(Val* v)
|
||||||
{
|
{
|
||||||
BroType* vt = v->Type();
|
BroType* vt = v->Type();
|
||||||
if ( ! IsRecord(vt->Tag()) )
|
if ( ! IsRecord(vt->Tag()) )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
RecordType* vr = vt->AsRecordType();
|
RecordType* vr = vt->AsRecordType();
|
||||||
const val_list* vl = v->AsRecord();
|
const val_list* vl = v->AsRecord();
|
||||||
|
@ -931,7 +931,7 @@ Connection* NetSessions::FindConnection(Val* v)
|
||||||
resp_p = vr->FieldOffset("resp_p");
|
resp_p = vr->FieldOffset("resp_p");
|
||||||
|
|
||||||
if ( orig_h < 0 || resp_h < 0 || orig_p < 0 || resp_p < 0 )
|
if ( orig_h < 0 || resp_h < 0 || orig_p < 0 || resp_p < 0 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
// ### we ought to check that the fields have the right
|
// ### we ought to check that the fields have the right
|
||||||
// types, too.
|
// types, too.
|
||||||
|
@ -967,7 +967,7 @@ Connection* NetSessions::FindConnection(Val* v)
|
||||||
// This can happen due to pseudo-connections we
|
// This can happen due to pseudo-connections we
|
||||||
// construct, for example for packet headers embedded
|
// construct, for example for packet headers embedded
|
||||||
// in ICMPs.
|
// in ICMPs.
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection* conn = nullptr;
|
Connection* conn = nullptr;
|
||||||
|
@ -1151,7 +1151,7 @@ Connection* NetSessions::NewConn(const ConnIDKey& k, double t, const ConnID* id,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
reporter->InternalWarning("unknown transport protocol");
|
reporter->InternalWarning("unknown transport protocol");
|
||||||
return 0;
|
return nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( tproto == TRANSPORT_TCP )
|
if ( tproto == TRANSPORT_TCP )
|
||||||
|
@ -1163,7 +1163,7 @@ Connection* NetSessions::NewConn(const ConnIDKey& k, double t, const ConnID* id,
|
||||||
bool flip = false;
|
bool flip = false;
|
||||||
|
|
||||||
if ( ! WantConnection(src_h, dst_h, tproto, flags, flip) )
|
if ( ! WantConnection(src_h, dst_h, tproto, flags, flip) )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
Connection* conn = new Connection(this, k, t, id, flow_label, pkt, encapsulation);
|
Connection* conn = new Connection(this, k, t, id, flow_label, pkt, encapsulation);
|
||||||
conn->SetTransport(tproto);
|
conn->SetTransport(tproto);
|
||||||
|
@ -1175,11 +1175,11 @@ Connection* NetSessions::NewConn(const ConnIDKey& k, double t, const ConnID* id,
|
||||||
{
|
{
|
||||||
conn->Done();
|
conn->Done();
|
||||||
Unref(conn);
|
Unref(conn);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( new_connection )
|
if ( new_connection )
|
||||||
conn->Event(new_connection, 0);
|
conn->Event(new_connection, nullptr);
|
||||||
|
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,9 +75,9 @@ public:
|
||||||
void GetStats(SessionStats& s) const;
|
void GetStats(SessionStats& s) const;
|
||||||
|
|
||||||
void Weird(const char* name, const Packet* pkt,
|
void Weird(const char* name, const Packet* pkt,
|
||||||
const EncapsulationStack* encap = 0, const char* addl = "");
|
const EncapsulationStack* encap = nullptr, const char* addl = "");
|
||||||
void Weird(const char* name, const IP_Hdr* ip,
|
void Weird(const char* name, const IP_Hdr* ip,
|
||||||
const EncapsulationStack* encap = 0, const char* addl = "");
|
const EncapsulationStack* encap = nullptr, const char* addl = "");
|
||||||
|
|
||||||
PacketFilter* GetPacketFilter()
|
PacketFilter* GetPacketFilter()
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,22 +61,22 @@ VectorVal* BroSubstring::VecToPolicy(Vec* vec)
|
||||||
RecordType* sw_substring_type =
|
RecordType* sw_substring_type =
|
||||||
internal_type("sw_substring")->AsRecordType();
|
internal_type("sw_substring")->AsRecordType();
|
||||||
if ( ! sw_substring_type )
|
if ( ! sw_substring_type )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
RecordType* sw_align_type =
|
RecordType* sw_align_type =
|
||||||
internal_type("sw_align")->AsRecordType();
|
internal_type("sw_align")->AsRecordType();
|
||||||
if ( ! sw_align_type )
|
if ( ! sw_align_type )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
VectorType* sw_align_vec_type =
|
VectorType* sw_align_vec_type =
|
||||||
internal_type("sw_align_vec")->AsVectorType();
|
internal_type("sw_align_vec")->AsVectorType();
|
||||||
if ( ! sw_align_vec_type )
|
if ( ! sw_align_vec_type )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
VectorVal* result =
|
VectorVal* result =
|
||||||
new VectorVal(internal_type("sw_substring_vec")->AsVectorType());
|
new VectorVal(internal_type("sw_substring_vec")->AsVectorType());
|
||||||
if ( ! result )
|
if ( ! result )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( vec )
|
if ( vec )
|
||||||
{
|
{
|
||||||
|
@ -235,9 +235,9 @@ public:
|
||||||
{
|
{
|
||||||
// Make sure access is in allowed range.
|
// Make sure access is in allowed range.
|
||||||
if ( row < 0 || row >= _rows )
|
if ( row < 0 || row >= _rows )
|
||||||
return 0;
|
return nullptr;
|
||||||
if ( col < 0 || col >= _cols )
|
if ( col < 0 || col >= _cols )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return &(_nodes[row * _cols + col]);
|
return &(_nodes[row * _cols + col]);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ static void sw_collect_multiple(BroSubstring::Vec* result,
|
||||||
{
|
{
|
||||||
BroSubstring::Vec* old_al = *it;
|
BroSubstring::Vec* old_al = *it;
|
||||||
|
|
||||||
if ( old_al == 0 )
|
if ( old_al == nullptr )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for ( BroSubstring::VecIt it2 = old_al->begin();
|
for ( BroSubstring::VecIt it2 = old_al->begin();
|
||||||
|
@ -372,7 +372,7 @@ static void sw_collect_multiple(BroSubstring::Vec* result,
|
||||||
{
|
{
|
||||||
delete_each(new_al);
|
delete_each(new_al);
|
||||||
delete new_al;
|
delete new_al;
|
||||||
new_al = 0;
|
new_al = nullptr;
|
||||||
goto end_loop;
|
goto end_loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ end_loop:
|
||||||
{
|
{
|
||||||
BroSubstring::Vec* al = *it;
|
BroSubstring::Vec* al = *it;
|
||||||
|
|
||||||
if ( al == 0 )
|
if ( al == nullptr )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for ( BroSubstring::VecIt it2 = al->begin();
|
for ( BroSubstring::VecIt it2 = al->begin();
|
||||||
|
@ -432,8 +432,8 @@ BroSubstring::Vec* smith_waterman(const BroString* s1, const BroString* s2,
|
||||||
byte_vec string2 = s2->Bytes();
|
byte_vec string2 = s2->Bytes();
|
||||||
|
|
||||||
SWNodeMatrix matrix(s1, s2); // dynamic programming matrix.
|
SWNodeMatrix matrix(s1, s2); // dynamic programming matrix.
|
||||||
SWNode* node_max = 0; // pointer to the best score's node
|
SWNode* node_max = nullptr; // pointer to the best score's node
|
||||||
SWNode* node_br_max = 0; // pointer to lowest-right matching node
|
SWNode* node_br_max = nullptr; // pointer to lowest-right matching node
|
||||||
|
|
||||||
// The highest score in the matrix, globally. We initialize to 1
|
// The highest score in the matrix, globally. We initialize to 1
|
||||||
// because we are only interested in real scores (initializing to
|
// because we are only interested in real scores (initializing to
|
||||||
|
|
10
src/Stats.cc
10
src/Stats.cc
|
@ -339,7 +339,7 @@ void ProfileLogger::SegmentProfile(const char* name, const Location* loc,
|
||||||
|
|
||||||
SampleLogger::SampleLogger()
|
SampleLogger::SampleLogger()
|
||||||
{
|
{
|
||||||
static TableType* load_sample_info = 0;
|
static TableType* load_sample_info = nullptr;
|
||||||
|
|
||||||
if ( ! load_sample_info )
|
if ( ! load_sample_info )
|
||||||
load_sample_info = internal_type("load_sample_info")->AsTableType();
|
load_sample_info = internal_type("load_sample_info")->AsTableType();
|
||||||
|
@ -355,14 +355,14 @@ SampleLogger::~SampleLogger()
|
||||||
void SampleLogger::FunctionSeen(const Func* func)
|
void SampleLogger::FunctionSeen(const Func* func)
|
||||||
{
|
{
|
||||||
Val* idx = new StringVal(func->Name());
|
Val* idx = new StringVal(func->Name());
|
||||||
load_samples->Assign(idx, 0);
|
load_samples->Assign(idx, nullptr);
|
||||||
Unref(idx);
|
Unref(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SampleLogger::LocationSeen(const Location* loc)
|
void SampleLogger::LocationSeen(const Location* loc)
|
||||||
{
|
{
|
||||||
Val* idx = new StringVal(loc->filename);
|
Val* idx = new StringVal(loc->filename);
|
||||||
load_samples->Assign(idx, 0);
|
load_samples->Assign(idx, nullptr);
|
||||||
Unref(idx);
|
Unref(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ void PacketProfiler::ProfilePkt(double t, unsigned int bytes)
|
||||||
getrusage(RUSAGE_SELF, &res);
|
getrusage(RUSAGE_SELF, &res);
|
||||||
gettimeofday(&ptimestamp, 0);
|
gettimeofday(&ptimestamp, 0);
|
||||||
|
|
||||||
get_memory_usage(&last_mem, 0);
|
get_memory_usage(&last_mem, nullptr);
|
||||||
last_Utime = res.ru_utime.tv_sec + res.ru_utime.tv_usec / 1e6;
|
last_Utime = res.ru_utime.tv_sec + res.ru_utime.tv_usec / 1e6;
|
||||||
last_Stime = res.ru_stime.tv_sec + res.ru_stime.tv_usec / 1e6;
|
last_Stime = res.ru_stime.tv_sec + res.ru_stime.tv_usec / 1e6;
|
||||||
last_Rtime = ptimestamp.tv_sec + ptimestamp.tv_usec / 1e6;
|
last_Rtime = ptimestamp.tv_sec + ptimestamp.tv_usec / 1e6;
|
||||||
|
@ -462,7 +462,7 @@ void PacketProfiler::ProfilePkt(double t, unsigned int bytes)
|
||||||
ptimestamp.tv_sec + ptimestamp.tv_usec / 1e6;
|
ptimestamp.tv_sec + ptimestamp.tv_usec / 1e6;
|
||||||
|
|
||||||
uint64_t curr_mem;
|
uint64_t curr_mem;
|
||||||
get_memory_usage(&curr_mem, 0);
|
get_memory_usage(&curr_mem, nullptr);
|
||||||
|
|
||||||
file->Write(fmt("%.06f %.03f %" PRIu64 " %" PRIu64 " %.03f %.03f %.03f %" PRIu64 "\n",
|
file->Write(fmt("%.06f %.03f %" PRIu64 " %" PRIu64 " %.03f %.03f %.03f %" PRIu64 "\n",
|
||||||
t, time-last_timestamp, pkt_cnt, byte_cnt,
|
t, time-last_timestamp, pkt_cnt, byte_cnt,
|
||||||
|
|
26
src/Stmt.cc
26
src/Stmt.cc
|
@ -182,7 +182,7 @@ TraversalCode ExprListStmt::Traverse(TraversalCallback* cb) const
|
||||||
HANDLE_TC_STMT_POST(tc);
|
HANDLE_TC_STMT_POST(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BroFile* print_stdout = 0;
|
static BroFile* print_stdout = nullptr;
|
||||||
|
|
||||||
static IntrusivePtr<EnumVal> lookup_enum_val(const char* module_name, const char* name)
|
static IntrusivePtr<EnumVal> lookup_enum_val(const char* module_name, const char* name)
|
||||||
{
|
{
|
||||||
|
@ -629,7 +629,7 @@ SwitchStmt::SwitchStmt(IntrusivePtr<Expr> index, case_list* arg_cases)
|
||||||
NegExpr* ne = (NegExpr*)(expr);
|
NegExpr* ne = (NegExpr*)(expr);
|
||||||
|
|
||||||
if ( ne->Op()->IsConst() )
|
if ( ne->Op()->IsConst() )
|
||||||
Unref(exprs.replace(j, new ConstExpr(ne->Eval(0))));
|
Unref(exprs.replace(j, new ConstExpr(ne->Eval(nullptr))));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ SwitchStmt::SwitchStmt(IntrusivePtr<Expr> index, case_list* arg_cases)
|
||||||
PosExpr* pe = (PosExpr*)(expr);
|
PosExpr* pe = (PosExpr*)(expr);
|
||||||
|
|
||||||
if ( pe->Op()->IsConst() )
|
if ( pe->Op()->IsConst() )
|
||||||
Unref(exprs.replace(j, new ConstExpr(pe->Eval(0))));
|
Unref(exprs.replace(j, new ConstExpr(pe->Eval(nullptr))));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ SwitchStmt::SwitchStmt(IntrusivePtr<Expr> index, case_list* arg_cases)
|
||||||
|
|
||||||
if ( ne->Id()->IsConst() )
|
if ( ne->Id()->IsConst() )
|
||||||
{
|
{
|
||||||
auto v = ne->Eval(0);
|
auto v = ne->Eval(nullptr);
|
||||||
|
|
||||||
if ( v )
|
if ( v )
|
||||||
Unref(exprs.replace(j, new ConstExpr(std::move(v))));
|
Unref(exprs.replace(j, new ConstExpr(std::move(v))));
|
||||||
|
@ -757,7 +757,7 @@ bool SwitchStmt::AddCaseLabelTypeMapping(ID* t, int idx)
|
||||||
std::pair<int, ID*> SwitchStmt::FindCaseLabelMatch(const Val* v) const
|
std::pair<int, ID*> SwitchStmt::FindCaseLabelMatch(const Val* v) const
|
||||||
{
|
{
|
||||||
int label_idx = -1;
|
int label_idx = -1;
|
||||||
ID* label_id = 0;
|
ID* label_id = nullptr;
|
||||||
|
|
||||||
// Find matching expression cases.
|
// Find matching expression cases.
|
||||||
if ( case_label_value_map.Length() )
|
if ( case_label_value_map.Length() )
|
||||||
|
@ -1065,7 +1065,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
||||||
: ExprStmt(STMT_FOR, std::move(loop_expr))
|
: ExprStmt(STMT_FOR, std::move(loop_expr))
|
||||||
{
|
{
|
||||||
loop_vars = arg_loop_vars;
|
loop_vars = arg_loop_vars;
|
||||||
body = 0;
|
body = nullptr;
|
||||||
|
|
||||||
if ( e->Type()->Tag() == TYPE_TABLE )
|
if ( e->Type()->Tag() == TYPE_TABLE )
|
||||||
{
|
{
|
||||||
|
@ -1090,7 +1090,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
||||||
{
|
{
|
||||||
add_local({NewRef{}, (*loop_vars)[i]},
|
add_local({NewRef{}, (*loop_vars)[i]},
|
||||||
{NewRef{}, ind_type}, INIT_NONE,
|
{NewRef{}, ind_type}, INIT_NONE,
|
||||||
0, 0, VAR_REGULAR);
|
nullptr, nullptr, VAR_REGULAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1106,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
||||||
BroType* t = (*loop_vars)[0]->Type();
|
BroType* t = (*loop_vars)[0]->Type();
|
||||||
if ( ! t )
|
if ( ! t )
|
||||||
add_local({NewRef{}, (*loop_vars)[0]}, base_type(TYPE_COUNT),
|
add_local({NewRef{}, (*loop_vars)[0]}, base_type(TYPE_COUNT),
|
||||||
INIT_NONE, 0, 0, VAR_REGULAR);
|
INIT_NONE, nullptr, nullptr, VAR_REGULAR);
|
||||||
|
|
||||||
else if ( ! IsIntegral(t->Tag()) )
|
else if ( ! IsIntegral(t->Tag()) )
|
||||||
{
|
{
|
||||||
|
@ -1127,7 +1127,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars, IntrusivePtr<Expr> loop_expr)
|
||||||
if ( ! t )
|
if ( ! t )
|
||||||
add_local({NewRef{}, (*loop_vars)[0]},
|
add_local({NewRef{}, (*loop_vars)[0]},
|
||||||
base_type(TYPE_STRING),
|
base_type(TYPE_STRING),
|
||||||
INIT_NONE, 0, 0, VAR_REGULAR);
|
INIT_NONE, nullptr, nullptr, VAR_REGULAR);
|
||||||
|
|
||||||
else if ( t->Tag() != TYPE_STRING )
|
else if ( t->Tag() != TYPE_STRING )
|
||||||
{
|
{
|
||||||
|
@ -1158,7 +1158,7 @@ ForStmt::ForStmt(id_list* arg_loop_vars,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
add_local(value_var, {NewRef{}, yield_type}, INIT_NONE,
|
add_local(value_var, {NewRef{}, yield_type}, INIT_NONE,
|
||||||
0, 0, VAR_REGULAR);
|
nullptr, nullptr, VAR_REGULAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1471,7 +1471,7 @@ void ReturnStmt::Describe(ODesc* d) const
|
||||||
{
|
{
|
||||||
Stmt::Describe(d);
|
Stmt::Describe(d);
|
||||||
if ( ! d->IsReadable() )
|
if ( ! d->IsReadable() )
|
||||||
d->Add(e != 0);
|
d->Add(e != nullptr);
|
||||||
|
|
||||||
if ( e )
|
if ( e )
|
||||||
{
|
{
|
||||||
|
@ -1600,7 +1600,7 @@ IntrusivePtr<Val> EventBodyList::Exec(Frame* f, stmt_flow_type& flow) const
|
||||||
|
|
||||||
// Simulate a return so the hooks operate properly.
|
// Simulate a return so the hooks operate properly.
|
||||||
stmt_flow_type ft = FLOW_RETURN;
|
stmt_flow_type ft = FLOW_RETURN;
|
||||||
(void) post_execute_stmt(f->GetNextStmt(), f, 0, &ft);
|
(void) post_execute_stmt(f->GetNextStmt(), f, nullptr, &ft);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1656,7 +1656,7 @@ IntrusivePtr<Val> InitStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||||
{
|
{
|
||||||
BroType* t = aggr->Type();
|
BroType* t = aggr->Type();
|
||||||
|
|
||||||
Val* v = 0;
|
Val* v = nullptr;
|
||||||
|
|
||||||
switch ( t->Tag() ) {
|
switch ( t->Tag() ) {
|
||||||
case TYPE_RECORD:
|
case TYPE_RECORD:
|
||||||
|
|
|
@ -41,13 +41,13 @@ Tag::Tag()
|
||||||
{
|
{
|
||||||
type = 0;
|
type = 0;
|
||||||
subtype = 0;
|
subtype = 0;
|
||||||
val = 0;
|
val = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag::~Tag()
|
Tag::~Tag()
|
||||||
{
|
{
|
||||||
Unref(val);
|
Unref(val);
|
||||||
val = 0;
|
val = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag& Tag::operator=(const Tag& other)
|
Tag& Tag::operator=(const Tag& other)
|
||||||
|
|
|
@ -12,7 +12,7 @@ class ID;
|
||||||
|
|
||||||
class TraversalCallback {
|
class TraversalCallback {
|
||||||
public:
|
public:
|
||||||
TraversalCallback() { current_scope = 0; }
|
TraversalCallback() { current_scope = nullptr; }
|
||||||
virtual ~TraversalCallback() {}
|
virtual ~TraversalCallback() {}
|
||||||
|
|
||||||
virtual TraversalCode PreFunction(const Func*) { return TC_CONTINUE; }
|
virtual TraversalCode PreFunction(const Func*) { return TC_CONTINUE; }
|
||||||
|
|
|
@ -130,10 +130,10 @@ Trigger::Trigger(Expr* arg_cond, Stmt* arg_body, Stmt* arg_timeout_stmts,
|
||||||
timeout_stmts = arg_timeout_stmts;
|
timeout_stmts = arg_timeout_stmts;
|
||||||
timeout = arg_timeout;
|
timeout = arg_timeout;
|
||||||
frame = arg_frame->Clone();
|
frame = arg_frame->Clone();
|
||||||
timer = 0;
|
timer = nullptr;
|
||||||
delayed = false;
|
delayed = false;
|
||||||
disabled = false;
|
disabled = false;
|
||||||
attached = 0;
|
attached = nullptr;
|
||||||
is_return = arg_is_return;
|
is_return = arg_is_return;
|
||||||
location = arg_location;
|
location = arg_location;
|
||||||
timeout_value = -1;
|
timeout_value = -1;
|
||||||
|
|
|
@ -129,7 +129,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
class EncapsulationStack {
|
class EncapsulationStack {
|
||||||
public:
|
public:
|
||||||
EncapsulationStack() : conns(0)
|
EncapsulationStack() : conns(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
EncapsulationStack(const EncapsulationStack& other)
|
EncapsulationStack(const EncapsulationStack& other)
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
if ( other.conns )
|
if ( other.conns )
|
||||||
conns = new vector<EncapsulatingConn>(*(other.conns));
|
conns = new vector<EncapsulatingConn>(*(other.conns));
|
||||||
else
|
else
|
||||||
conns = 0;
|
conns = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
EncapsulationStack& operator=(const EncapsulationStack& other)
|
EncapsulationStack& operator=(const EncapsulationStack& other)
|
||||||
|
@ -150,7 +150,7 @@ public:
|
||||||
if ( other.conns )
|
if ( other.conns )
|
||||||
conns = new vector<EncapsulatingConn>(*(other.conns));
|
conns = new vector<EncapsulatingConn>(*(other.conns));
|
||||||
else
|
else
|
||||||
conns = 0;
|
conns = nullptr;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
14
src/Type.cc
14
src/Type.cc
|
@ -541,7 +541,7 @@ void FuncType::Describe(ODesc* d) const
|
||||||
{
|
{
|
||||||
d->Add(int(Tag()));
|
d->Add(int(Tag()));
|
||||||
d->Add(flavor);
|
d->Add(flavor);
|
||||||
d->Add(yield != 0);
|
d->Add(yield != nullptr);
|
||||||
args->DescribeFields(d);
|
args->DescribeFields(d);
|
||||||
if ( yield )
|
if ( yield )
|
||||||
yield->Describe(d);
|
yield->Describe(d);
|
||||||
|
@ -648,7 +648,7 @@ bool RecordType::HasField(const char* field) const
|
||||||
BroType* RecordType::FieldType(const char* field) const
|
BroType* RecordType::FieldType(const char* field) const
|
||||||
{
|
{
|
||||||
int offset = FieldOffset(field);
|
int offset = FieldOffset(field);
|
||||||
return offset >= 0 ? FieldType(offset) : 0;
|
return offset >= 0 ? FieldType(offset) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BroType* RecordType::FieldType(int field) const
|
BroType* RecordType::FieldType(int field) const
|
||||||
|
@ -783,7 +783,7 @@ IntrusivePtr<TableVal> RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
||||||
if ( fv )
|
if ( fv )
|
||||||
::Ref(fv);
|
::Ref(fv);
|
||||||
|
|
||||||
bool logged = (fd->attrs && fd->FindAttr(ATTR_LOG) != 0);
|
bool logged = (fd->attrs && fd->FindAttr(ATTR_LOG) != nullptr);
|
||||||
|
|
||||||
auto nr = make_intrusive<RecordVal>(internal_type("record_field")->AsRecordType());
|
auto nr = make_intrusive<RecordVal>(internal_type("record_field")->AsRecordType());
|
||||||
|
|
||||||
|
@ -1575,10 +1575,10 @@ bool same_type(const BroType* t1, const BroType* t2, bool is_init, bool match_re
|
||||||
bool same_attrs(const Attributes* a1, const Attributes* a2)
|
bool same_attrs(const Attributes* a1, const Attributes* a2)
|
||||||
{
|
{
|
||||||
if ( ! a1 )
|
if ( ! a1 )
|
||||||
return (a2 == 0);
|
return (a2 == nullptr);
|
||||||
|
|
||||||
if ( ! a2 )
|
if ( ! a2 )
|
||||||
return (a1 == 0);
|
return (a1 == nullptr);
|
||||||
|
|
||||||
return (*a1 == *a2);
|
return (*a1 == *a2);
|
||||||
}
|
}
|
||||||
|
@ -2023,7 +2023,7 @@ IntrusivePtr<BroType> init_type(Expr* init)
|
||||||
// Could be a record, a set, or a list of table elements.
|
// Could be a record, a set, or a list of table elements.
|
||||||
Expr* e0 = el[0];
|
Expr* e0 = el[0];
|
||||||
|
|
||||||
if ( e0->IsRecordElement(0) )
|
if ( e0->IsRecordElement(nullptr) )
|
||||||
// ListExpr's know how to build a record from their
|
// ListExpr's know how to build a record from their
|
||||||
// components.
|
// components.
|
||||||
return init_list->InitType();
|
return init_list->InitType();
|
||||||
|
@ -2039,7 +2039,7 @@ IntrusivePtr<BroType> init_type(Expr* init)
|
||||||
for ( int i = 1; t && i < el.length(); ++i )
|
for ( int i = 1; t && i < el.length(); ++i )
|
||||||
{
|
{
|
||||||
auto el_t = el[i]->InitType();
|
auto el_t = el[i]->InitType();
|
||||||
BroType* ti = el_t ? reduce_type(el_t.get()) : 0;
|
BroType* ti = el_t ? reduce_type(el_t.get()) : nullptr;
|
||||||
|
|
||||||
if ( ! ti )
|
if ( ! ti )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
16
src/Type.h
16
src/Type.h
|
@ -304,12 +304,12 @@ public:
|
||||||
|
|
||||||
bool IsSet() const
|
bool IsSet() const
|
||||||
{
|
{
|
||||||
return tag == TYPE_TABLE && (YieldType() == 0);
|
return tag == TYPE_TABLE && (YieldType() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsTable() const
|
bool IsTable() const
|
||||||
{
|
{
|
||||||
return tag == TYPE_TABLE && (YieldType() != 0);
|
return tag == TYPE_TABLE && (YieldType() != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
BroType* Ref() { ::Ref(this); return this; }
|
BroType* Ref() { ::Ref(this); return this; }
|
||||||
|
@ -357,7 +357,7 @@ public:
|
||||||
const type_list* Types() const { return &types; }
|
const type_list* Types() const { return &types; }
|
||||||
type_list* Types() { return &types; }
|
type_list* Types() { return &types; }
|
||||||
|
|
||||||
bool IsPure() const { return pure_type != 0; }
|
bool IsPure() const { return pure_type != nullptr; }
|
||||||
|
|
||||||
// Returns the underlying pure type, or nil if the list
|
// Returns the underlying pure type, or nil if the list
|
||||||
// is not pure or is empty.
|
// is not pure or is empty.
|
||||||
|
@ -485,12 +485,12 @@ protected:
|
||||||
|
|
||||||
class TypeDecl final {
|
class TypeDecl final {
|
||||||
public:
|
public:
|
||||||
TypeDecl(IntrusivePtr<BroType> t, const char* i, attr_list* attrs = 0, bool in_record = false);
|
TypeDecl(IntrusivePtr<BroType> t, const char* i, attr_list* attrs = nullptr, bool in_record = false);
|
||||||
TypeDecl(const TypeDecl& other);
|
TypeDecl(const TypeDecl& other);
|
||||||
~TypeDecl();
|
~TypeDecl();
|
||||||
|
|
||||||
const Attr* FindAttr(attr_tag a) const
|
const Attr* FindAttr(attr_tag a) const
|
||||||
{ return attrs ? attrs->FindAttr(a) : 0; }
|
{ return attrs ? attrs->FindAttr(a) : nullptr; }
|
||||||
|
|
||||||
void DescribeReST(ODesc* d, bool roles_only = false) const;
|
void DescribeReST(ODesc* d, bool roles_only = false) const;
|
||||||
|
|
||||||
|
@ -547,19 +547,19 @@ public:
|
||||||
bool IsFieldDeprecated(int field) const
|
bool IsFieldDeprecated(int field) const
|
||||||
{
|
{
|
||||||
const TypeDecl* decl = FieldDecl(field);
|
const TypeDecl* decl = FieldDecl(field);
|
||||||
return decl && decl->FindAttr(ATTR_DEPRECATED) != 0;
|
return decl && decl->FindAttr(ATTR_DEPRECATED) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FieldHasAttr(int field, attr_tag at) const
|
bool FieldHasAttr(int field, attr_tag at) const
|
||||||
{
|
{
|
||||||
const TypeDecl* decl = FieldDecl(field);
|
const TypeDecl* decl = FieldDecl(field);
|
||||||
return decl && decl->FindAttr(at) != 0;
|
return decl && decl->FindAttr(at) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetFieldDeprecationWarning(int field, bool has_check) const;
|
std::string GetFieldDeprecationWarning(int field, bool has_check) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RecordType() { types = 0; }
|
RecordType() { types = nullptr; }
|
||||||
|
|
||||||
int num_fields;
|
int num_fields;
|
||||||
type_decl_list* types;
|
type_decl_list* types;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
* Construct a UID of a given bit-length, optionally from given values.
|
* Construct a UID of a given bit-length, optionally from given values.
|
||||||
* @see UID::Set
|
* @see UID::Set
|
||||||
*/
|
*/
|
||||||
explicit UID(bro_uint_t bits, const uint64_t* v = 0, size_t n = 0)
|
explicit UID(bro_uint_t bits, const uint64_t* v = nullptr, size_t n = 0)
|
||||||
{ Set(bits, v, n); }
|
{ Set(bits, v, n); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
* 64, then a value is truncated to bit in desired bit-length.
|
* 64, then a value is truncated to bit in desired bit-length.
|
||||||
* @param n number of 64-bit elements in array pointed to by \a v.
|
* @param n number of 64-bit elements in array pointed to by \a v.
|
||||||
*/
|
*/
|
||||||
void Set(bro_uint_t bits, const uint64_t* v = 0, size_t n = 0);
|
void Set(bro_uint_t bits, const uint64_t* v = nullptr, size_t n = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a base62 (characters 0-9, A-Z, a-z) representation of the UID.
|
* Returns a base62 (characters 0-9, A-Z, a-z) representation of the UID.
|
||||||
|
|
46
src/Val.cc
46
src/Val.cc
|
@ -48,7 +48,7 @@ Val::Val(Func* f)
|
||||||
|
|
||||||
static FileType* GetStringFileType() noexcept
|
static FileType* GetStringFileType() noexcept
|
||||||
{
|
{
|
||||||
static FileType* string_file_type = 0;
|
static FileType* string_file_type = nullptr;
|
||||||
if ( ! string_file_type )
|
if ( ! string_file_type )
|
||||||
string_file_type = new FileType(base_type(TYPE_STRING));
|
string_file_type = new FileType(base_type(TYPE_STRING));
|
||||||
return string_file_type;
|
return string_file_type;
|
||||||
|
@ -366,13 +366,13 @@ void Val::ValDescribeReST(ODesc* d) const
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
ID* Val::GetID() const
|
ID* Val::GetID() const
|
||||||
{
|
{
|
||||||
return bound_id ? global_scope()->Lookup(bound_id) : 0;
|
return bound_id ? global_scope()->Lookup(bound_id) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Val::SetID(ID* id)
|
void Val::SetID(ID* id)
|
||||||
{
|
{
|
||||||
delete [] bound_id;
|
delete [] bound_id;
|
||||||
bound_id = id ? copy_string(id->Name()) : 0;
|
bound_id = id ? copy_string(id->Name()) : nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1233,7 +1233,7 @@ TableVal* ListVal::ConvertToSet() const
|
||||||
TableVal* t = new TableVal(std::move(s));
|
TableVal* t = new TableVal(std::move(s));
|
||||||
|
|
||||||
for ( const auto& val : vals )
|
for ( const auto& val : vals )
|
||||||
t->Assign(val, 0);
|
t->Assign(val, nullptr);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -1381,16 +1381,16 @@ TableVal::TableVal(IntrusivePtr<TableType> t, IntrusivePtr<Attributes> a) : Val(
|
||||||
void TableVal::Init(IntrusivePtr<TableType> t)
|
void TableVal::Init(IntrusivePtr<TableType> t)
|
||||||
{
|
{
|
||||||
table_type = std::move(t);
|
table_type = std::move(t);
|
||||||
expire_func = 0;
|
expire_func = nullptr;
|
||||||
expire_time = 0;
|
expire_time = nullptr;
|
||||||
expire_cookie = 0;
|
expire_cookie = nullptr;
|
||||||
timer = 0;
|
timer = nullptr;
|
||||||
def_val = 0;
|
def_val = nullptr;
|
||||||
|
|
||||||
if ( table_type->IsSubNetIndex() )
|
if ( table_type->IsSubNetIndex() )
|
||||||
subnets = new PrefixTable;
|
subnets = new PrefixTable;
|
||||||
else
|
else
|
||||||
subnets = 0;
|
subnets = nullptr;
|
||||||
|
|
||||||
table_hash = new CompositeHash(IntrusivePtr<TypeList>(NewRef{},
|
table_hash = new CompositeHash(IntrusivePtr<TypeList>(NewRef{},
|
||||||
table_type->Indices()));
|
table_type->Indices()));
|
||||||
|
@ -1603,12 +1603,12 @@ bool TableVal::AddTo(Val* val, bool is_first_init, bool propagate_ops) const
|
||||||
|
|
||||||
if ( type->IsSet() )
|
if ( type->IsSet() )
|
||||||
{
|
{
|
||||||
if ( ! t->Assign(v->Value(), k, 0) )
|
if ( ! t->Assign(v->Value(), k, nullptr) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( ! t->Assign(0, k, {NewRef{}, v->Value()}) )
|
if ( ! t->Assign(nullptr, k, {NewRef{}, v->Value()}) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1804,11 +1804,11 @@ IntrusivePtr<Val> TableVal::Default(Val* index)
|
||||||
auto coerce = make_intrusive<RecordCoerceExpr>(
|
auto coerce = make_intrusive<RecordCoerceExpr>(
|
||||||
IntrusivePtr{NewRef{}, def_attr->AttrExpr()},
|
IntrusivePtr{NewRef{}, def_attr->AttrExpr()},
|
||||||
IntrusivePtr{NewRef{}, ytype->AsRecordType()});
|
IntrusivePtr{NewRef{}, ytype->AsRecordType()});
|
||||||
def_val = coerce->Eval(0);
|
def_val = coerce->Eval(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
def_val = def_attr->AttrExpr()->Eval(0);
|
def_val = def_attr->AttrExpr()->Eval(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! def_val )
|
if ( ! def_val )
|
||||||
|
@ -1942,7 +1942,7 @@ IntrusivePtr<TableVal> TableVal::LookupSubnetValues(const SubNetVal* search)
|
||||||
if ( entry && entry->Value() )
|
if ( entry && entry->Value() )
|
||||||
nt->Assign(s, {NewRef{}, entry->Value()});
|
nt->Assign(s, {NewRef{}, entry->Value()});
|
||||||
else
|
else
|
||||||
nt->Assign(s, 0); // set
|
nt->Assign(s, nullptr); // set
|
||||||
|
|
||||||
if ( entry )
|
if ( entry )
|
||||||
{
|
{
|
||||||
|
@ -2050,7 +2050,7 @@ void TableVal::CallChangeFunc(const Val* index, Val* old_value, OnChangeType tpe
|
||||||
IntrusivePtr<Val> TableVal::Delete(const Val* index)
|
IntrusivePtr<Val> TableVal::Delete(const Val* index)
|
||||||
{
|
{
|
||||||
HashKey* k = ComputeHash(index);
|
HashKey* k = ComputeHash(index);
|
||||||
TableEntryVal* v = k ? AsNonConstTable()->RemoveEntry(k) : 0;
|
TableEntryVal* v = k ? AsNonConstTable()->RemoveEntry(k) : nullptr;
|
||||||
IntrusivePtr<Val> va{NewRef{}, v ? (v->Value() ? v->Value() : this) : nullptr};
|
IntrusivePtr<Val> va{NewRef{}, v ? (v->Value() ? v->Value() : this) : nullptr};
|
||||||
|
|
||||||
if ( subnets && ! subnets->Remove(index) )
|
if ( subnets && ! subnets->Remove(index) )
|
||||||
|
@ -2128,7 +2128,7 @@ ListVal* TableVal::ConvertToPureList() const
|
||||||
if ( tl->length() != 1 )
|
if ( tl->length() != 1 )
|
||||||
{
|
{
|
||||||
InternalWarning("bad index type in TableVal::ConvertToPureList");
|
InternalWarning("bad index type in TableVal::ConvertToPureList");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConvertToList((*tl)[0]->Tag());
|
return ConvertToList((*tl)[0]->Tag());
|
||||||
|
@ -2136,7 +2136,7 @@ ListVal* TableVal::ConvertToPureList() const
|
||||||
|
|
||||||
Attr* TableVal::FindAttr(attr_tag t) const
|
Attr* TableVal::FindAttr(attr_tag t) const
|
||||||
{
|
{
|
||||||
return attrs ? attrs->FindAttr(t) : 0;
|
return attrs ? attrs->FindAttr(t) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableVal::Describe(ODesc* d) const
|
void TableVal::Describe(ODesc* d) const
|
||||||
|
@ -2253,7 +2253,7 @@ bool TableVal::ExpandCompoundAndInit(val_list* vl, int k, IntrusivePtr<Val> new_
|
||||||
|
|
||||||
bool TableVal::CheckAndAssign(Val* index, IntrusivePtr<Val> new_val)
|
bool TableVal::CheckAndAssign(Val* index, IntrusivePtr<Val> new_val)
|
||||||
{
|
{
|
||||||
Val* v = 0;
|
Val* v = nullptr;
|
||||||
if ( subnets )
|
if ( subnets )
|
||||||
// We need an exact match here.
|
// We need an exact match here.
|
||||||
v = (Val*) subnets->Lookup(index, true);
|
v = (Val*) subnets->Lookup(index, true);
|
||||||
|
@ -2392,7 +2392,7 @@ void TableVal::DoExpire(double t)
|
||||||
|
|
||||||
if ( ! v )
|
if ( ! v )
|
||||||
{
|
{
|
||||||
expire_cookie = 0;
|
expire_cookie = nullptr;
|
||||||
InitTimer(table_expire_interval);
|
InitTimer(table_expire_interval);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2419,7 +2419,7 @@ double TableVal::GetExpireTime()
|
||||||
if ( interval >= 0 )
|
if ( interval >= 0 )
|
||||||
return interval;
|
return interval;
|
||||||
|
|
||||||
expire_time = 0;
|
expire_time = nullptr;
|
||||||
|
|
||||||
if ( timer )
|
if ( timer )
|
||||||
timer_mgr->Cancel(timer);
|
timer_mgr->Cancel(timer);
|
||||||
|
@ -2819,7 +2819,7 @@ IntrusivePtr<RecordVal> RecordVal::CoerceTo(RecordType* t, bool allow_orphaning)
|
||||||
if ( same_type(Type(), t) )
|
if ( same_type(Type(), t) )
|
||||||
return {NewRef{}, this};
|
return {NewRef{}, this};
|
||||||
|
|
||||||
return CoerceTo(t, 0, allow_orphaning);
|
return CoerceTo(t, nullptr, allow_orphaning);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrusivePtr<TableVal> RecordVal::GetRecordFieldsVal() const
|
IntrusivePtr<TableVal> RecordVal::GetRecordFieldsVal() const
|
||||||
|
@ -2975,7 +2975,7 @@ bool VectorVal::Assign(unsigned int index, IntrusivePtr<Val> element)
|
||||||
! same_type(element->Type(), vector_type->YieldType(), false) )
|
! same_type(element->Type(), vector_type->YieldType(), false) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Val* val_at_index = 0;
|
Val* val_at_index = nullptr;
|
||||||
|
|
||||||
if ( index < val.vector_val->size() )
|
if ( index < val.vector_val->size() )
|
||||||
val_at_index = (*val.vector_val)[index];
|
val_at_index = (*val.vector_val)[index];
|
||||||
|
|
|
@ -310,7 +310,7 @@ public:
|
||||||
|
|
||||||
// To be overridden by mutable derived class to enable change
|
// To be overridden by mutable derived class to enable change
|
||||||
// notification.
|
// notification.
|
||||||
virtual notifier::Modifiable* Modifiable() { return 0; }
|
virtual notifier::Modifiable* Modifiable() { return nullptr; }
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// For debugging, we keep a reference to the global ID to which a
|
// For debugging, we keep a reference to the global ID to which a
|
||||||
|
@ -804,7 +804,7 @@ public:
|
||||||
void ClearTimer(Timer* t)
|
void ClearTimer(Timer* t)
|
||||||
{
|
{
|
||||||
if ( timer == t )
|
if ( timer == t )
|
||||||
timer = 0;
|
timer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashKey* ComputeHash(const Val* index) const;
|
HashKey* ComputeHash(const Val* index) const;
|
||||||
|
@ -843,7 +843,7 @@ protected:
|
||||||
IntrusivePtr<Val> Default(Val* index);
|
IntrusivePtr<Val> Default(Val* index);
|
||||||
|
|
||||||
// Returns true if item expiration is enabled.
|
// Returns true if item expiration is enabled.
|
||||||
bool ExpirationEnabled() { return expire_time != 0; }
|
bool ExpirationEnabled() { return expire_time != nullptr; }
|
||||||
|
|
||||||
// Returns the expiration time defined by %{create,read,write}_expire
|
// Returns the expiration time defined by %{create,read,write}_expire
|
||||||
// attribute, or -1 for unset/invalid values. In the invalid case, an
|
// attribute, or -1 for unset/invalid values. In the invalid case, an
|
||||||
|
|
|
@ -216,7 +216,7 @@ static void make_var(ID* id, IntrusivePtr<BroType> t, init_class c,
|
||||||
// For events, add a function value (without any body) here so that
|
// For events, add a function value (without any body) here so that
|
||||||
// we can later access the ID even if no implementations have been
|
// we can later access the ID even if no implementations have been
|
||||||
// defined.
|
// defined.
|
||||||
Func* f = new BroFunc(id, 0, 0, 0, 0);
|
Func* f = new BroFunc(id, nullptr, nullptr, 0, 0);
|
||||||
id->SetVal(make_intrusive<Val>(f));
|
id->SetVal(make_intrusive<Val>(f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ static void transfer_arg_defaults(RecordType* args, RecordType* recv)
|
||||||
TypeDecl* args_i = args->FieldDecl(i);
|
TypeDecl* args_i = args->FieldDecl(i);
|
||||||
TypeDecl* recv_i = recv->FieldDecl(i);
|
TypeDecl* recv_i = recv->FieldDecl(i);
|
||||||
|
|
||||||
Attr* def = args_i->attrs ? args_i->attrs->FindAttr(ATTR_DEFAULT) : 0;
|
Attr* def = args_i->attrs ? args_i->attrs->FindAttr(ATTR_DEFAULT) : nullptr;
|
||||||
|
|
||||||
if ( ! def )
|
if ( ! def )
|
||||||
continue;
|
continue;
|
||||||
|
@ -379,7 +379,7 @@ void begin_func(ID* id, const char* module_name, function_flavor flavor,
|
||||||
case FUNC_FLAVOR_HOOK:
|
case FUNC_FLAVOR_HOOK:
|
||||||
if ( is_redef )
|
if ( is_redef )
|
||||||
// Clear out value so it will be replaced.
|
// Clear out value so it will be replaced.
|
||||||
id->SetVal(0);
|
id->SetVal(nullptr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNC_FLAVOR_FUNCTION:
|
case FUNC_FLAVOR_FUNCTION:
|
||||||
|
|
|
@ -695,7 +695,7 @@ RecordVal* Manager::MakeEvent(val_list* args, Frame* frame)
|
||||||
auto rval = new RecordVal(BifType::Record::Broker::Event);
|
auto rval = new RecordVal(BifType::Record::Broker::Event);
|
||||||
auto arg_vec = new VectorVal(vector_of_data_type);
|
auto arg_vec = new VectorVal(vector_of_data_type);
|
||||||
rval->Assign(1, arg_vec);
|
rval->Assign(1, arg_vec);
|
||||||
Func* func = 0;
|
Func* func = nullptr;
|
||||||
scoped_reporter_location srl{frame};
|
scoped_reporter_location srl{frame};
|
||||||
|
|
||||||
for ( auto i = 0; i < args->length(); ++i )
|
for ( auto i = 0; i < args->length(); ++i )
|
||||||
|
@ -738,7 +738,7 @@ RecordVal* Manager::MakeEvent(val_list* args, Frame* frame)
|
||||||
|
|
||||||
if ( ! same_type(got_type, expected_type) )
|
if ( ! same_type(got_type, expected_type) )
|
||||||
{
|
{
|
||||||
rval->Assign(0, 0);
|
rval->Assign(0, nullptr);
|
||||||
Error("event parameter #%d type mismatch, got %s, expect %s", i,
|
Error("event parameter #%d type mismatch, got %s, expect %s", i,
|
||||||
type_name(got_type->Tag()),
|
type_name(got_type->Tag()),
|
||||||
type_name(expected_type->Tag()));
|
type_name(expected_type->Tag()));
|
||||||
|
@ -758,7 +758,7 @@ RecordVal* Manager::MakeEvent(val_list* args, Frame* frame)
|
||||||
if ( ! data_val->Lookup(0) )
|
if ( ! data_val->Lookup(0) )
|
||||||
{
|
{
|
||||||
Unref(data_val);
|
Unref(data_val);
|
||||||
rval->Assign(0, 0);
|
rval->Assign(0, nullptr);
|
||||||
Error("failed to convert param #%d of type %s to broker data",
|
Error("failed to convert param #%d of type %s to broker data",
|
||||||
i, type_name(got_type->Tag()));
|
i, type_name(got_type->Tag()));
|
||||||
return rval;
|
return rval;
|
||||||
|
|
72
src/main.cc
72
src/main.cc
|
@ -84,44 +84,44 @@ int perftools_profile = 0;
|
||||||
|
|
||||||
DNS_Mgr* dns_mgr;
|
DNS_Mgr* dns_mgr;
|
||||||
TimerMgr* timer_mgr;
|
TimerMgr* timer_mgr;
|
||||||
ValManager* val_mgr = 0;
|
ValManager* val_mgr = nullptr;
|
||||||
logging::Manager* log_mgr = 0;
|
logging::Manager* log_mgr = nullptr;
|
||||||
threading::Manager* thread_mgr = 0;
|
threading::Manager* thread_mgr = nullptr;
|
||||||
input::Manager* input_mgr = 0;
|
input::Manager* input_mgr = nullptr;
|
||||||
plugin::Manager* plugin_mgr = 0;
|
plugin::Manager* plugin_mgr = nullptr;
|
||||||
analyzer::Manager* analyzer_mgr = 0;
|
analyzer::Manager* analyzer_mgr = nullptr;
|
||||||
file_analysis::Manager* file_mgr = 0;
|
file_analysis::Manager* file_mgr = nullptr;
|
||||||
zeekygen::Manager* zeekygen_mgr = 0;
|
zeekygen::Manager* zeekygen_mgr = nullptr;
|
||||||
iosource::Manager* iosource_mgr = 0;
|
iosource::Manager* iosource_mgr = nullptr;
|
||||||
bro_broker::Manager* broker_mgr = 0;
|
bro_broker::Manager* broker_mgr = nullptr;
|
||||||
zeek::Supervisor* zeek::supervisor_mgr = 0;
|
zeek::Supervisor* zeek::supervisor_mgr = nullptr;
|
||||||
trigger::Manager* trigger_mgr = 0;
|
trigger::Manager* trigger_mgr = nullptr;
|
||||||
|
|
||||||
std::vector<std::string> zeek_script_prefixes;
|
std::vector<std::string> zeek_script_prefixes;
|
||||||
Stmt* stmts;
|
Stmt* stmts;
|
||||||
EventHandlerPtr net_done = 0;
|
EventHandlerPtr net_done = nullptr;
|
||||||
RuleMatcher* rule_matcher = 0;
|
RuleMatcher* rule_matcher = nullptr;
|
||||||
EventRegistry* event_registry = 0;
|
EventRegistry* event_registry = nullptr;
|
||||||
ProfileLogger* profiling_logger = 0;
|
ProfileLogger* profiling_logger = nullptr;
|
||||||
ProfileLogger* segment_logger = 0;
|
ProfileLogger* segment_logger = nullptr;
|
||||||
SampleLogger* sample_logger = 0;
|
SampleLogger* sample_logger = nullptr;
|
||||||
int signal_val = 0;
|
int signal_val = 0;
|
||||||
extern char version[];
|
extern char version[];
|
||||||
const char* command_line_policy = 0;
|
const char* command_line_policy = nullptr;
|
||||||
vector<string> params;
|
vector<string> params;
|
||||||
set<string> requested_plugins;
|
set<string> requested_plugins;
|
||||||
const char* proc_status_file = 0;
|
const char* proc_status_file = nullptr;
|
||||||
|
|
||||||
OpaqueType* md5_type = 0;
|
OpaqueType* md5_type = nullptr;
|
||||||
OpaqueType* sha1_type = 0;
|
OpaqueType* sha1_type = nullptr;
|
||||||
OpaqueType* sha256_type = 0;
|
OpaqueType* sha256_type = nullptr;
|
||||||
OpaqueType* entropy_type = 0;
|
OpaqueType* entropy_type = nullptr;
|
||||||
OpaqueType* cardinality_type = 0;
|
OpaqueType* cardinality_type = nullptr;
|
||||||
OpaqueType* topk_type = 0;
|
OpaqueType* topk_type = nullptr;
|
||||||
OpaqueType* bloomfilter_type = 0;
|
OpaqueType* bloomfilter_type = nullptr;
|
||||||
OpaqueType* x509_opaque_type = 0;
|
OpaqueType* x509_opaque_type = nullptr;
|
||||||
OpaqueType* ocsp_resp_opaque_type = 0;
|
OpaqueType* ocsp_resp_opaque_type = nullptr;
|
||||||
OpaqueType* paraglob_type = 0;
|
OpaqueType* paraglob_type = nullptr;
|
||||||
|
|
||||||
// Keep copy of command line
|
// Keep copy of command line
|
||||||
int bro_argc;
|
int bro_argc;
|
||||||
|
@ -130,7 +130,7 @@ char** bro_argv;
|
||||||
const char* zeek_version()
|
const char* zeek_version()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static char* debug_version = 0;
|
static char* debug_version = nullptr;
|
||||||
|
|
||||||
if ( ! debug_version )
|
if ( ! debug_version )
|
||||||
{
|
{
|
||||||
|
@ -311,7 +311,7 @@ void terminate_bro()
|
||||||
// free the global scope
|
// free the global scope
|
||||||
pop_scope();
|
pop_scope();
|
||||||
|
|
||||||
reporter = 0;
|
reporter = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeek_terminate_loop(const char* reason)
|
void zeek_terminate_loop(const char* reason)
|
||||||
|
@ -527,8 +527,8 @@ int main(int argc, char** argv)
|
||||||
if ( options.random_seed_input_file )
|
if ( options.random_seed_input_file )
|
||||||
seed_load_file = options.random_seed_input_file->data();
|
seed_load_file = options.random_seed_input_file->data();
|
||||||
|
|
||||||
init_random_seed((seed_load_file && *seed_load_file ? seed_load_file : 0),
|
init_random_seed((seed_load_file && *seed_load_file ? seed_load_file : nullptr),
|
||||||
options.random_seed_output_file ? options.random_seed_output_file->data() : 0);
|
options.random_seed_output_file ? options.random_seed_output_file->data() : nullptr);
|
||||||
// DEBUG_MSG("HMAC key: %s\n", md5_digest_print(shared_hmac_md5_key));
|
// DEBUG_MSG("HMAC key: %s\n", md5_digest_print(shared_hmac_md5_key));
|
||||||
init_hash_function();
|
init_hash_function();
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if ( g_policy_debug )
|
if ( g_policy_debug )
|
||||||
// ### Add support for debug command file.
|
// ### Add support for debug command file.
|
||||||
dbg_init_debugger(0);
|
dbg_init_debugger(nullptr);
|
||||||
|
|
||||||
if ( ! options.pcap_file && ! options.interface )
|
if ( ! options.pcap_file && ! options.interface )
|
||||||
{
|
{
|
||||||
|
@ -847,7 +847,7 @@ int main(int argc, char** argv)
|
||||||
if ( stmts )
|
if ( stmts )
|
||||||
{
|
{
|
||||||
stmt_flow_type flow;
|
stmt_flow_type flow;
|
||||||
Frame f(current_scope()->Length(), 0, 0);
|
Frame f(current_scope()->Length(), nullptr, nullptr);
|
||||||
g_frame_stack.push_back(&f);
|
g_frame_stack.push_back(&f);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
18
src/util.cc
18
src/util.cc
|
@ -277,7 +277,7 @@ std::string get_escaped_string(const char* str, size_t len, bool escape_all)
|
||||||
char* copy_string(const char* s)
|
char* copy_string(const char* s)
|
||||||
{
|
{
|
||||||
if ( ! s )
|
if ( ! s )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
char* c = new char[strlen(s)+1];
|
char* c = new char[strlen(s)+1];
|
||||||
strcpy(c, s);
|
strcpy(c, s);
|
||||||
|
@ -558,7 +558,7 @@ const char* strpbrk_n(size_t len, const char* s, const char* charset)
|
||||||
if ( strchr(charset, *p) )
|
if ( strchr(charset, *p) )
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_STRCASESTR
|
#ifndef HAVE_STRCASESTR
|
||||||
|
@ -819,7 +819,7 @@ const char* fmt_bytes(const char* data, int len)
|
||||||
|
|
||||||
const char* vfmt(const char* format, va_list al)
|
const char* vfmt(const char* format, va_list al)
|
||||||
{
|
{
|
||||||
static char* buf = 0;
|
static char* buf = nullptr;
|
||||||
static unsigned int buf_len = 1024;
|
static unsigned int buf_len = 1024;
|
||||||
|
|
||||||
if ( ! buf )
|
if ( ! buf )
|
||||||
|
@ -1017,7 +1017,7 @@ void hmac_md5(size_t size, const unsigned char* bytes, unsigned char digest[16])
|
||||||
static bool read_random_seeds(const char* read_file, uint32_t* seed,
|
static bool read_random_seeds(const char* read_file, uint32_t* seed,
|
||||||
uint32_t* buf, int bufsiz)
|
uint32_t* buf, int bufsiz)
|
||||||
{
|
{
|
||||||
FILE* f = 0;
|
FILE* f = nullptr;
|
||||||
|
|
||||||
if ( ! (f = fopen(read_file, "r")) )
|
if ( ! (f = fopen(read_file, "r")) )
|
||||||
{
|
{
|
||||||
|
@ -1053,7 +1053,7 @@ static bool read_random_seeds(const char* read_file, uint32_t* seed,
|
||||||
static bool write_random_seeds(const char* write_file, uint32_t seed,
|
static bool write_random_seeds(const char* write_file, uint32_t seed,
|
||||||
uint32_t* buf, int bufsiz)
|
uint32_t* buf, int bufsiz)
|
||||||
{
|
{
|
||||||
FILE* f = 0;
|
FILE* f = nullptr;
|
||||||
|
|
||||||
if ( ! (f = fopen(write_file, "w+")) )
|
if ( ! (f = fopen(write_file, "w+")) )
|
||||||
{
|
{
|
||||||
|
@ -1345,7 +1345,7 @@ bool is_package_loader(const string& path)
|
||||||
FILE* open_file(const string& path, const string& mode)
|
FILE* open_file(const string& path, const string& mode)
|
||||||
{
|
{
|
||||||
if ( path.empty() )
|
if ( path.empty() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
FILE* rval = fopen(path.c_str(), mode.c_str());
|
FILE* rval = fopen(path.c_str(), mode.c_str());
|
||||||
|
|
||||||
|
@ -1384,7 +1384,7 @@ FILE* open_package(string& path, const string& mode)
|
||||||
string package_loader = "__load__" + script_extensions[0];
|
string package_loader = "__load__" + script_extensions[0];
|
||||||
reporter->Error("Failed to open package '%s': missing '%s' file",
|
reporter->Error("Failed to open package '%s': missing '%s' file",
|
||||||
arg_path.c_str(), package_loader.c_str());
|
arg_path.c_str(), package_loader.c_str());
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("util path ops")
|
TEST_CASE("util path ops")
|
||||||
|
@ -1810,7 +1810,7 @@ FILE* rotate_file(const char* name, RecordVal* rotate_info)
|
||||||
if ( ! newf )
|
if ( ! newf )
|
||||||
{
|
{
|
||||||
reporter->Error("rotate_file: can't open %s: %s", tmpname, strerror(errno));
|
reporter->Error("rotate_file: can't open %s: %s", tmpname, strerror(errno));
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then move old file to "<name>.<pid>.<timestamp>" and make sure
|
// Then move old file to "<name>.<pid>.<timestamp>" and make sure
|
||||||
|
@ -1822,7 +1822,7 @@ FILE* rotate_file(const char* name, RecordVal* rotate_info)
|
||||||
fclose(newf);
|
fclose(newf);
|
||||||
unlink(newname);
|
unlink(newname);
|
||||||
unlink(tmpname);
|
unlink(tmpname);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close current file, and move the tmp to its place.
|
// Close current file, and move the tmp to its place.
|
||||||
|
|
|
@ -139,7 +139,7 @@ inline std::string get_escaped_string(const std::string& str, bool escape_all)
|
||||||
|
|
||||||
std::vector<std::string>* tokenize_string(std::string_view input,
|
std::vector<std::string>* tokenize_string(std::string_view input,
|
||||||
std::string_view delim,
|
std::string_view delim,
|
||||||
std::vector<std::string>* rval = 0, int limit = 0);
|
std::vector<std::string>* rval = nullptr, int limit = 0);
|
||||||
|
|
||||||
std::vector<std::string_view> tokenize_string(std::string_view input, const char delim) noexcept;
|
std::vector<std::string_view> tokenize_string(std::string_view input, const char delim) noexcept;
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ extern char* strcasestr(const char* s, const char* find);
|
||||||
#endif
|
#endif
|
||||||
extern const char* strpbrk_n(size_t len, const char* s, const char* charset);
|
extern const char* strpbrk_n(size_t len, const char* s, const char* charset);
|
||||||
template<class T> int atoi_n(int len, const char* s, const char** end, int base, T& result);
|
template<class T> int atoi_n(int len, const char* s, const char** end, int base, T& result);
|
||||||
extern char* uitoa_n(uint64_t value, char* str, int n, int base, const char* prefix=0);
|
extern char* uitoa_n(uint64_t value, char* str, int n, int base, const char* prefix=nullptr);
|
||||||
int strstr_n(const int big_len, const unsigned char* big,
|
int strstr_n(const int big_len, const unsigned char* big,
|
||||||
const int little_len, const unsigned char* little);
|
const int little_len, const unsigned char* little);
|
||||||
extern int fputs(int len, const char* s, FILE* fp);
|
extern int fputs(int len, const char* s, FILE* fp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue