summaryrefslogtreecommitdiff
path: root/src/misc.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-07-09 00:20:00 -0400
committerAdam <Adam@anope.org>2010-07-09 00:20:00 -0400
commit7e20659522abae28509a38f2010a5508eae3b6c3 (patch)
tree3b81fd041f223e446c875c46f9a182ebb1815943 /src/misc.cpp
parent1cf4ebb231f2f7770b717a5e176d7bb5cbc66284 (diff)
No need to allocate the numberlist callback classes with new
Diffstat (limited to 'src/misc.cpp')
-rw-r--r--src/misc.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/misc.cpp b/src/misc.cpp
index e8d6d14f3..eb8b28f83 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -223,7 +223,7 @@ const char *merge_args(int argc, char **argv)
/*************************************************************************/
-NumberList::NumberList(const std::string &list, bool descending) : desc(descending)
+NumberList::NumberList(const std::string &list, bool descending) : desc(descending), is_valid(true)
{
char *error;
commasepstream sep(list);
@@ -245,7 +245,7 @@ NumberList::NumberList(const std::string &list, bool descending) : desc(descendi
{
if (!this->InvalidRange(list))
{
- delete this;
+ is_valid = false;
return;
}
}
@@ -264,7 +264,7 @@ NumberList::NumberList(const std::string &list, bool descending) : desc(descendi
{
if (!this->InvalidRange(list))
{
- delete this;
+ is_valid = false;
return;
}
}
@@ -278,6 +278,9 @@ NumberList::~NumberList()
void NumberList::Process()
{
+ if (!is_valid)
+ return;
+
if (this->desc)
{
for (std::set<unsigned>::reverse_iterator it = numbers.rbegin(), it_end = numbers.rend(); it != it_end; ++it)