From 86c1dab2863f228e92ce7e0bd23ffb17cda0242b Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 16 Sep 2010 21:16:20 -0400 Subject: Fixed many bugs and crashes --- include/extensible.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/extensible.h b/include/extensible.h index 884ca8ecb..29ac0504c 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -89,12 +89,10 @@ class CoreExport Extensible : public virtual Base * * @return Returns true on success, false if otherwise */ - bool Extend(const Anope::string &key, ExtensibleItemBase *p) + void Extend(const Anope::string &key, ExtensibleItemBase *p) { - bool Ret = this->Extension_Items.insert(std::make_pair(key, p)).second; - if (!Ret) - delete p; - return Ret; + this->Shrink(key); + this->Extension_Items.insert(std::make_pair(key, p)); } /** Extend an Extensible class. @@ -108,13 +106,9 @@ class CoreExport Extensible : public virtual Base * * @return Returns true on success, false if otherwise */ - bool Extend(const Anope::string &key) + void Extend(const Anope::string &key) { - /* This will only add an item if it doesnt already exist, - * the return value is a std::pair of an iterator to the - * element, and a bool saying if it was actually inserted. - */ - return this->Extend(key, new ExtensibleItemRegular(NULL)); + this->Extend(key, new ExtensibleItemRegular(NULL)); } /** Shrink an Extensible class. -- cgit