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

Switch Destroy methods to delete

This commit is contained in:
Adam
2013-02-14 20:58:01 -05:00
parent 391f2822c8
commit fc1d7ea89b
32 changed files with 62 additions and 62 deletions
+2 -2
View File
@@ -75,11 +75,11 @@ class CoreExport Serializable : public virtual Base
Serializable(const Anope::string &serialize_type);
Serializable(const Serializable &);
virtual ~Serializable();
Serializable &operator=(const Serializable &);
public:
virtual ~Serializable();
/* Unique ID (per type, not globally) for this object */
unsigned int id;
+1 -1
View File
@@ -242,7 +242,7 @@ class CommandBSBot : public Command
Log(LOG_ADMIN, source, this) << "DEL " << bi->nick;
source.Reply(_("Bot \002%s\002 has been deleted."), nick.c_str());
bi->Destroy();
delete bi;
return;
}
public:
+1 -1
View File
@@ -286,7 +286,7 @@ class CommandCSAccess : public Command
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask;
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, access));
access->Destroy();
delete access;
}
return;
}
+1 -1
View File
@@ -59,7 +59,7 @@ public:
if (what.empty())
{
target_ci->Destroy();
delete target_ci;
target_ci = new ChannelInfo(*ci);
target_ci->name = target;
(*RegisteredChannelList)[target_ci->name] = target_ci;
+1 -1
View File
@@ -57,7 +57,7 @@ class CommandCSDrop : public Command
FOREACH_MOD(I_OnChanDrop, OnChanDrop(ci));
Channel *c = ci->c;
ci->Destroy();
delete ci;
source.Reply(_("Channel \002%s\002 has been dropped."), chan.c_str());
+2 -2
View File
@@ -161,7 +161,7 @@ class CommandEntryMessage : public Command
unsigned i = convertTo<unsigned>(message);
if (i > 0 && i <= (*messages)->size())
{
(*messages)->at(i - 1)->Destroy();
delete (*messages)->at(i - 1);
(*messages)->erase((*messages)->begin() + i - 1);
if ((*messages)->empty())
ci->Shrink("cs_entrymsg");
@@ -184,7 +184,7 @@ class CommandEntryMessage : public Command
if (messages != NULL)
{
for (unsigned i = 0; i < (*messages)->size(); ++i)
(*messages)->at(i)->Destroy();
delete (*messages)->at(i);
(*messages)->clear();
ci->Shrink("cs_entrymsg");
}
+2 -2
View File
@@ -180,7 +180,7 @@ class CommandCSFlags : public Command
if (current != NULL)
{
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, current));
current->Destroy();
delete current;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask;
source.Reply(_("\002%s\002 removed from the %s access list."), mask.c_str(), ci->name.c_str());
}
@@ -203,7 +203,7 @@ class CommandCSFlags : public Command
access->flags = current_flags;
if (current != NULL)
current->Destroy();
delete current;
ci->AddAccess(access);
+1 -1
View File
@@ -117,7 +117,7 @@ public:
{
if (log->extra == extra)
{
log->Destroy();
delete log;
ci->log_settings->erase(ci->log_settings->begin() + i - 1);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
source.Reply(_("Logging for command %s on %s with log method %s%s%s has been removed."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
+2 -2
View File
@@ -152,7 +152,7 @@ class CommandOSSeen : public Command
if (time < buf->second->last)
{
Log(LOG_DEBUG) << buf->first << " was last seen " << Anope::strftime(buf->second->last) << ", deleting entry";
buf->second->Destroy();
delete buf->second;
database.erase(buf);
counter++;
}
@@ -309,7 +309,7 @@ class DataBasePurger : public CallBack
if ((Anope::CurTime - cur->second->last) > purgetime)
{
Log(LOG_DEBUG) << cur->first << " was last seen " << Anope::strftime(cur->second->last) << ", purging entries";
cur->second->Destroy();
delete cur->second;
database.erase(cur);
}
}
+1 -1
View File
@@ -411,7 +411,7 @@ class XOPBase : public Command
source.Reply(_("\002%s\002 deleted from %s %s list."), a->mask.c_str(), ci->name.c_str(), source.command.c_str());
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, a));
a->Destroy();
delete a;
return;
}
+1 -1
View File
@@ -114,7 +114,7 @@ class CommandMSDel : public Command
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(i)));
else
FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.nc, mi, mi->GetMemo(i)));
mi->GetMemo(i)->Destroy();
delete mi->GetMemo(i);
}
mi->memos->clear();
if (!chan.empty())
+1 -1
View File
@@ -161,7 +161,7 @@ class CommandNSAJoin : public Command
source.Reply(_("%s was not found on %s's auto join list."), chan.c_str(), nc->display.c_str());
else
{
(*channels)->at(i)->Destroy();
delete (*channels)->at(i);
(*channels)->erase((*channels)->begin() + i);
source.Reply(_("%s was removed from %s's auto join list."), chan.c_str(), nc->display.c_str());
}
+1 -1
View File
@@ -55,7 +55,7 @@ class CommandNSDrop : public Command
FOREACH_MOD(I_OnNickDrop, OnNickDrop(source, na));
Log(!is_mine ? LOG_OVERRIDE : LOG_COMMAND, source, this) << "to drop nickname " << na->nick << " (group: " << na->nc->display << ") (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
na->Destroy();
delete na;
if (!is_mine)
{
+1 -1
View File
@@ -34,7 +34,7 @@ class NSGroupRequest : public IdentifyRequest
if (na)
{
FOREACH_MOD(I_OnChangeCoreDisplay, OnChangeCoreDisplay(na->nc, u->nick));
na->Destroy();
delete na;
}
na = new NickAlias(nick, target->nc);
+2 -2
View File
@@ -172,7 +172,7 @@ class CommandOSAKill : public Command
{
source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str());
Log(LOG_ADMIN, source, this) << "tried to akill " << percent << "% of the network (" << affected << " users)";
x->Destroy();
delete x;
return;
}
@@ -180,7 +180,7 @@ class CommandOSAKill : public Command
FOREACH_RESULT(I_OnAddXLine, OnAddXLine(source, x, akills));
if (MOD_RESULT == EVENT_STOP)
{
x->Destroy();
delete x;
return;
}
+3 -3
View File
@@ -312,7 +312,7 @@ class CommandOSDNS : public Command
}
source.Reply(_("Zone %s removed."), z->name.c_str());
z->Destroy();
delete z;
}
void AddServer(CommandSource &source, const std::vector<Anope::string> &params)
@@ -370,7 +370,7 @@ class CommandOSDNS : public Command
if (!z)
{
source.Reply(_("Zone %s does not exist."), zone.c_str());
s->Destroy();
delete s;
return;
}
@@ -426,7 +426,7 @@ class CommandOSDNS : public Command
Log(LOG_ADMIN, source, this) << "to delete server " << s->GetName();
source.Reply(_("Removed server %s."), s->GetName().c_str());
s->Destroy();
delete s;
}
void AddIP(CommandSource &source, const std::vector<Anope::string> &params)
+2 -2
View File
@@ -31,7 +31,7 @@ class MyForbidService : public ForbidService
std::vector<ForbidData *>::iterator it = std::find(this->forbid_data->begin(), this->forbid_data->end(), d);
if (it != this->forbid_data->end())
this->forbid_data->erase(it);
d->Destroy();
delete d;
}
ForbidData *FindForbid(const Anope::string &mask, ForbidType ftype) anope_override
@@ -65,7 +65,7 @@ class MyForbidService : public ForbidService
Log(LOG_NORMAL, "expire/forbid") << "Expiring forbid for " << d->mask << " type " << ftype;
this->forbid_data->erase(this->forbid_data->begin() + i - 1);
d->Destroy();
delete d;
}
}
+2 -2
View File
@@ -72,7 +72,7 @@ class MyNewsService : public NewsService
{
for (unsigned i = 0; i < 3; ++i)
for (unsigned j = 0; j < newsItems[i].size(); ++j)
newsItems[i][j]->Destroy();
delete newsItems[i][j];
}
void AddNewsItem(NewsItem *n)
@@ -86,7 +86,7 @@ class MyNewsService : public NewsService
std::vector<NewsItem *>::iterator it = std::find(list.begin(), list.end(), n);
if (it != list.end())
list.erase(it);
n->Destroy();
delete n;
}
std::vector<NewsItem *> &GetNewsList(NewsType t)
+3 -3
View File
@@ -103,7 +103,7 @@ class ExpireTimer : public Timer
continue;
Log(OperServ, "expire/exception") << "Session exception for " << e->mask << "has expired.";
session_service->DelException(e);
e->Destroy();
delete e;
}
}
};
@@ -144,7 +144,7 @@ class ExceptionDelCallback : public NumberList
FOREACH_MOD(I_OnExceptionDel, OnExceptionDel(source, e));
session_service->DelException(e);
e->Destroy();
delete e;
}
};
@@ -352,7 +352,7 @@ class CommandOSException : public Command
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnExceptionAdd, OnExceptionAdd(exception));
if (MOD_RESULT == EVENT_STOP)
exception->Destroy();
delete exception;
else
{
session_service->AddException(exception);
+4 -4
View File
@@ -366,7 +366,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
{
source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str());
Log(LOG_ADMIN, source, this) << "tried to " << source.command << " " << percent << "% of the network (" << affected << " users)";
x->Destroy();
delete x;
return;
}
@@ -374,7 +374,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
FOREACH_RESULT(I_OnAddXLine, OnAddXLine(source, x, this->xlm()));
if (MOD_RESULT == EVENT_STOP)
{
x->Destroy();
delete x;
return;
}
@@ -571,7 +571,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
{
source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str());
Log(LOG_ADMIN, source, this) << "tried to SQLine " << percent << "% of the network (" << affected << " users)";
x->Destroy();
delete x;
return;
}
@@ -579,7 +579,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
FOREACH_RESULT(I_OnAddXLine, OnAddXLine(source, x, this->xlm()));
if (MOD_RESULT == EVENT_STOP)
{
x->Destroy();
delete x;
return;
}
+2 -2
View File
@@ -195,7 +195,7 @@ class DBMySQL : public Module, public Pipe
clear_null = true;
std::map<unsigned int, Serializable *>::iterator it = obj->objects.find(id);
if (it != obj->objects.end())
it->second->Destroy(); // This also removes this object from the map
delete it->second; // This also removes this object from the map
}
else
{
@@ -225,7 +225,7 @@ class DBMySQL : public Module, public Pipe
else
{
delete data;
s->Destroy();
delete s;
}
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ class DNSBLResolver : public Request
else
{
IRCD->SendAkill(NULL, x);
x->Destroy();
delete x;
}
}
};
+1 -1
View File
@@ -98,7 +98,7 @@ class ProxyConnect : public ConnectionSocket
IRCD->SendSZLine(NULL, x);
else
IRCD->SendAkill(NULL, x);
x->Destroy();
delete x;
}
}
};
@@ -70,7 +70,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
denied = true;
}
else
acc->Destroy();
delete acc;
break;
}
}
+2 -2
View File
@@ -56,7 +56,7 @@ class ExpireCallback : public CallBack
Log(LOG_NORMAL, "chanserv/expire") << "Expiring " << extra << "channel " << ci->name << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << ")";
FOREACH_MOD(I_OnChanExpire, OnChanExpire(ci));
ci->Destroy();
delete ci;
}
}
}
@@ -142,7 +142,7 @@ class ChanServCore : public Module
{
Log(LOG_NORMAL, "chanserv/expire") << "Deleting channel " << ci->name << " owned by deleted nick " << nc->display;
ci->Destroy();
delete ci;
continue;
}
}
+1 -1
View File
@@ -177,7 +177,7 @@ class ExpireCallback : public CallBack
extra = "suspended ";
Log(LOG_NORMAL, "expire") << "Expiring " << extra << "nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
FOREACH_MOD(I_OnNickExpire, OnNickExpire(na));
na->Destroy();
delete na;
}
}
}
+1 -1
View File
@@ -944,7 +944,7 @@ static bool DoneServices(ServerConfig *config, const Anope::string &)
++it;
if (bi->conf && services.count(bi->nick) == 0)
bi->Destroy();
delete bi;
}
services.clear();
return true;
+1 -1
View File
@@ -101,7 +101,7 @@ void MemoInfo::Del(unsigned index)
{
if (index >= this->memos->size())
return;
this->GetMemo(index)->Destroy();
delete this->GetMemo(index);
}
bool MemoInfo::HasIgnore(User *u)
+1 -1
View File
@@ -62,7 +62,7 @@ NickAlias::~NickAlias()
this->nc->aliases->erase(it);
if (this->nc->aliases->empty())
{
this->nc->Destroy();
delete this->nc;
this->nc = NULL;
}
else
+1 -1
View File
@@ -63,7 +63,7 @@ NickCore::~NickCore()
if (!this->memos.memos->empty())
{
for (unsigned i = 0, end = this->memos.memos->size(); i < end; ++i)
this->memos.GetMemo(i)->Destroy();
delete this->memos.GetMemo(i);
this->memos.memos->clear();
}
}
+14 -14
View File
@@ -378,16 +378,16 @@ ChannelInfo::~ChannelInfo()
this->ClearBadWords();
for (unsigned i = 0; i < this->log_settings->size(); ++i)
this->log_settings->at(i)->Destroy();
delete this->log_settings->at(i);
this->log_settings->clear();
while (!this->mode_locks->empty())
this->mode_locks->begin()->second->Destroy();
delete this->mode_locks->begin()->second;
if (!this->memos.memos->empty())
{
for (unsigned i = 0, end = this->memos.memos->size(); i < end; ++i)
this->memos.GetMemo(i)->Destroy();
delete this->memos.GetMemo(i);
this->memos.memos->clear();
}
@@ -639,13 +639,13 @@ void ChannelInfo::EraseAccess(unsigned index)
if (this->access->empty() || index >= this->access->size())
return;
this->access->at(index)->Destroy();
delete this->access->at(index);
}
void ChannelInfo::ClearAccess()
{
for (unsigned i = this->access->size(); i > 0; --i)
this->GetAccess(i - 1)->Destroy();
delete this->GetAccess(i - 1);
}
AutoKick *ChannelInfo::AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t, time_t lu)
@@ -701,13 +701,13 @@ void ChannelInfo::EraseAkick(unsigned index)
if (this->akick->empty() || index >= this->akick->size())
return;
this->GetAkick(index)->Destroy();
delete this->GetAkick(index);
}
void ChannelInfo::ClearAkick()
{
while (!this->akick->empty())
this->akick->back()->Destroy();
delete this->akick->back();
}
BadWord* ChannelInfo::AddBadWord(const Anope::string &word, BadWordType type)
@@ -746,13 +746,13 @@ void ChannelInfo::EraseBadWord(unsigned index)
FOREACH_MOD(I_OnBadWordDel, OnBadWordDel(this, (*this->badwords)[index]));
this->badwords->at(index)->Destroy();
delete this->badwords->at(index);
}
void ChannelInfo::ClearBadWords()
{
while (!this->badwords->empty())
this->badwords->back()->Destroy();
delete this->badwords->back();
}
bool ChannelInfo::HasMLock(ChannelMode *mode, const Anope::string &param, bool status) const
@@ -793,7 +793,7 @@ bool ChannelInfo::SetMLock(ChannelMode *mode, bool status, const Anope::string &
if (mode->type == MODE_REGULAR || mode->type == MODE_PARAM)
{
for (ChannelInfo::ModeList::const_iterator it; (it = this->mode_locks->find(mode->name)) != this->mode_locks->end();)
it->second->Destroy();
delete it->second;
this->mode_locks->erase(mode->name);
}
else
@@ -808,7 +808,7 @@ bool ChannelInfo::SetMLock(ChannelMode *mode, bool status, const Anope::string &
const ModeLock *modelock = it->second;
if (modelock->param == param)
{
it->second->Destroy();
delete it->second;
break;
}
}
@@ -838,7 +838,7 @@ bool ChannelInfo::RemoveMLock(ChannelMode *mode, bool status, const Anope::strin
FOREACH_RESULT(I_OnUnMLock, OnUnMLock(this, it->second));
if (MOD_RESULT != EVENT_STOP)
{
it->second->Destroy();
delete it->second;
return true;
}
}
@@ -860,7 +860,7 @@ bool ChannelInfo::RemoveMLock(ChannelMode *mode, bool status, const Anope::strin
FOREACH_RESULT(I_OnUnMLock, OnUnMLock(this, it->second));
if (MOD_RESULT == EVENT_STOP)
return false;
it->second->Destroy();
delete it->second;
return true;
}
}
@@ -885,7 +885,7 @@ void ChannelInfo::RemoveMLock(ModeLock *mlock)
void ChannelInfo::ClearMLock()
{
while (!this->mode_locks->empty())
this->mode_locks->begin()->second->Destroy();
delete this->mode_locks->begin()->second;
this->mode_locks->clear();
}
+2 -2
View File
@@ -301,7 +301,7 @@ bool XLineManager::DelXLine(XLine *x)
{
this->SendDel(x);
x->Destroy();
delete x;
this->xlines->erase(it);
return true;
@@ -327,7 +327,7 @@ void XLineManager::Clear()
XLine *x = this->xlines->at(i);
if (!x->id.empty())
XLinesByUID->erase(x->id);
x->Destroy();
delete x;
}
this->xlines->clear();
}