summaryrefslogtreecommitdiff
path: root/src/modules/m_callerid.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-11-01 18:17:04 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-11-01 18:17:04 +0100
commitfbc73e20784b055485f676096e758d6aeed62e0c (patch)
tree8251c8473af414527becb989558a69c4e7dc49b4 /src/modules/m_callerid.cpp
parent5fb509060fa7552a25efccad11595898d420d476 (diff)
Add stdalgo::erase() and use it to simplify code
Diffstat (limited to 'src/modules/m_callerid.cpp')
-rw-r--r--src/modules/m_callerid.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index f15760dca..7f615494b 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -136,10 +136,7 @@ struct CallerIDExtInfo : public ExtensionItem
continue; // shouldn't happen, but oh well.
}
- std::list<callerid_data*>::iterator it2 = std::find(targ->wholistsme.begin(), targ->wholistsme.end(), dat);
- if (it2 != targ->wholistsme.end())
- targ->wholistsme.erase(it2);
- else
+ if (!stdalgo::erase(targ->wholistsme, dat))
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (2)");
}
delete dat;
@@ -323,11 +320,7 @@ public:
return false;
}
- std::list<callerid_data*>::iterator it = std::find(dat2->wholistsme.begin(), dat2->wholistsme.end(), dat);
- if (it != dat2->wholistsme.end())
- // Found me!
- dat2->wholistsme.erase(it);
- else
+ if (!stdalgo::erase(dat2->wholistsme, dat))
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (4)");