X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/46b0747592074017ff0ea4b33d4a7194235886e5..bec5d17c77e9cfc8482ffca062b8f500859bfe34:/stargazer/tariffs_impl.cpp diff --git a/stargazer/tariffs_impl.cpp b/stargazer/tariffs_impl.cpp index d47ecf8f..c8345eb1 100644 --- a/stargazer/tariffs_impl.cpp +++ b/stargazer/tariffs_impl.cpp @@ -99,8 +99,7 @@ if (name == NO_TARIFF_NAME) return &noTariff; STG_LOCKER lock(&mutex); -std::list::const_iterator ti; -ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name)); +const auto ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name)); if (ti != tariffs.end()) return &(*ti); @@ -123,8 +122,7 @@ if (!priv->tariffChg) STG_LOCKER lock(&mutex); -std::list::iterator ti; -ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(td.tariffConf.name)); +auto ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(td.tariffConf.name)); if (ti == tariffs.end()) { @@ -166,8 +164,7 @@ TARIFF_DATA td; { STG_LOCKER lock(&mutex); - std::list::iterator ti; - ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name)); + const auto ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name)); if (ti == tariffs.end()) { @@ -188,7 +185,7 @@ TARIFF_DATA td; tariffs.erase(ti); } -std::set *>::iterator ni = onDelNotifiers.begin(); +auto ni = onDelNotifiers.begin(); while (ni != onDelNotifiers.end()) { (*ni)->Notify(td); @@ -217,8 +214,7 @@ if (!priv->tariffChg) { STG_LOCKER lock(&mutex); - std::list::iterator ti; - ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name)); + const auto ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name)); if (ti != tariffs.end()) { @@ -238,7 +234,7 @@ if (store->AddTariff(name) < 0) } // Fire all "on add" notifiers -std::set *>::iterator ni = onAddNotifiers.begin(); +auto ni = onAddNotifiers.begin(); while (ni != onAddNotifiers.end()) { (*ni)->Notify(tariffs.back().GetTariffData()); @@ -251,12 +247,12 @@ WriteServLog("%s Tariff \'%s\' added.", return 0; } //----------------------------------------------------------------------------- -void TARIFFS_IMPL::GetTariffsData(std::list * tdl) const +void TARIFFS_IMPL::GetTariffsData(std::vector * tdl) const { assert(tdl != NULL && "Tariffs data list is not null"); STG_LOCKER lock(&mutex); -Tariffs::const_iterator it = tariffs.begin(); +auto it = tariffs.begin(); for (; it != tariffs.end(); ++it) { tdl->push_back(it->GetTariffData());