From: Bjoern Sikora Date: Fri, 28 Jan 2011 17:06:03 +0000 (+0100) Subject: Fixed unused variable. X-Git-Tag: v1.1~23 X-Git-Url: http://developer.intra2net.com/git/?p=bpdyndnsd;a=commitdiff_plain;h=0c0344aad18d3c43945899135bde05a77b3d04b9 Fixed unused variable. Fixed missing iterator initialization. Fixed get_last_update_time(). --- diff --git a/src/service.cpp b/src/service.cpp index 2414adb..58c84cb 100644 --- a/src/service.cpp +++ b/src/service.cpp @@ -326,8 +326,14 @@ void Service::set_last_update(const time_t current_time, const string& ip) */ time_t Service::get_last_update_time( ) { - std::map::reverse_iterator r_iter = LastUpdates.rbegin(); - return r_iter->first; + time_t last_update = 0; + if ( !LastUpdates.empty() ) + { + std::map::reverse_iterator r_iter = LastUpdates.rbegin(); + if ( r_iter != LastUpdates.rend() ) + last_update = r_iter->first; + } + return last_update; } diff --git a/src/updater.cpp b/src/updater.cpp index 58648f6..2922cb7 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -251,10 +251,9 @@ void Updater::update_services(bool changed_to_online) const if ( last_updates.size() > 0 ) { bool ip_burnt = true; - string ip_next_to_last_update; int max_equal_updates_in_succession = service->get_max_equal_updates_in_succession(); int i = 0; - for ( std::map::reverse_iterator r_iter; (r_iter != last_updates.rend()) && (i < max_equal_updates_in_succession); r_iter++ ) + for ( std::map::reverse_iterator r_iter = last_updates.rbegin(); (r_iter != last_updates.rend()) && (i < max_equal_updates_in_succession); r_iter++ ) { if ( i == 0 ) lastupdated = r_iter->first;