1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 04:06:41 +02:00

Optimize much of the database code and serialize code.

This commit is contained in:
Adam
2012-12-13 06:12:56 -05:00
parent 76ba147c22
commit c1077faa28
60 changed files with 1203 additions and 1057 deletions
+17 -5
View File
@@ -14,25 +14,37 @@
std::map<Anope::string, std::map<Anope::string, Service *> > Service::Services;
std::map<Anope::string, std::map<Anope::string, Anope::string> > Service::Aliases;
Base::Base()
Base::Base() : references(NULL)
{
}
Base::~Base()
{
for (std::set<ReferenceBase *>::iterator it = this->references.begin(), it_end = this->references.end(); it != it_end; ++it)
if (this->references != NULL)
{
(*it)->Invalidate();
for (std::set<ReferenceBase *>::iterator it = this->references->begin(), it_end = this->references->end(); it != it_end; ++it)
(*it)->Invalidate();
delete this->references;
}
}
void Base::AddReference(ReferenceBase *r)
{
this->references.insert(r);
if (this->references == NULL)
this->references = new std::set<ReferenceBase *>();
this->references->insert(r);
}
void Base::DelReference(ReferenceBase *r)
{
this->references.erase(r);
if (this->references != NULL)
{
this->references->erase(r);
if (this->references->empty())
{
delete this->references;
this->references = NULL;
}
}
}