Merge branch 'topic/jsiwek/template-containers-merge'

* topic/jsiwek/template-containers-merge:
  Fix a potential usage of List::remove_nth(-1)
  Change List::remote(const T&) to return a bool
  Fix debug build due to old int_list usage within assert
  Convert uses of loop_over_list to ranged-for loops
  Remove loop_over_queue (as an example for later removing loop_over_list)
  Change int_list in CCL.h to be a vector, fix uses of int_list to match
  Remove List<> usage from strings.bif
  Replace uses of the old Queue/PQueue generation code with new template versions
  Convert BaseQueue/Queue/PQueue into templates, including iterator support
  Replace uses of the old Dict generation code with new template versions
  Convert PDict into template
  Replace uses of the old List generation code with new template versions
  Convert BaseList/List/PList into templates, including iterator support

* Generally squashed fixups from topic/timw/template-containers

* Add missing include file in List.h: <cassert>
This commit is contained in:
Jon Siwek 2019-07-15 19:46:04 -07:00
commit 8c45937798
68 changed files with 1111 additions and 1249 deletions

View file

@ -143,16 +143,16 @@ Attributes::Attributes(attr_list* a, BroType* t, bool arg_in_record, bool is_glo
// rather than just taking over 'a' for ourselves, so that
// the necessary checking gets done.
loop_over_list(*a, i)
AddAttr((*a)[i]);
for ( const auto& attr : *a )
AddAttr(attr);
delete a;
}
Attributes::~Attributes()
{
loop_over_list(*attrs, i)
Unref((*attrs)[i]);
for ( const auto& attr : *attrs )
Unref(attr);
delete attrs;
@ -189,8 +189,8 @@ void Attributes::AddAttr(Attr* attr)
void Attributes::AddAttrs(Attributes* a)
{
attr_list* as = a->Attrs();
loop_over_list(*as, i)
AddAttr((*as)[i]);
for ( const auto& attr : *as )
AddAttr(attr);
Unref(a);
}
@ -200,9 +200,8 @@ Attr* Attributes::FindAttr(attr_tag t) const
if ( ! attrs )
return 0;
loop_over_list(*attrs, i)
for ( const auto& a : *attrs )
{
Attr* a = (*attrs)[i];
if ( a->Tag() == t )
return a;
}
@ -404,9 +403,8 @@ void Attributes::CheckAttr(Attr* a)
int num_expires = 0;
if ( attrs )
{
loop_over_list(*attrs, i)
for ( const auto& a : *attrs )
{
Attr* a = (*attrs)[i];
if ( a->Tag() == ATTR_EXPIRE_READ ||
a->Tag() == ATTR_EXPIRE_WRITE ||
a->Tag() == ATTR_EXPIRE_CREATE )
@ -519,9 +517,8 @@ bool Attributes::operator==(const Attributes& other) const
if ( ! other.attrs )
return false;
loop_over_list(*attrs, i)
for ( const auto& a : *attrs )
{
Attr* a = (*attrs)[i];
Attr* o = other.FindAttr(a->Tag());
if ( ! o )
@ -531,9 +528,8 @@ bool Attributes::operator==(const Attributes& other) const
return false;
}
loop_over_list(*other.attrs, j)
for ( const auto& o : *other.attrs )
{
Attr* o = (*other.attrs)[j];
Attr* a = FindAttr(o->Tag());
if ( ! a )