From 0e597a21d5cbcdb61c7820740997080a42bc363f Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 8 Aug 2006 08:06:40 +0000 Subject: Tue Aug 8 08:06:12 UTC 2006 Johnny Willemsen --- ACE/ChangeLog | 6 ++++++ ACE/ace/Select_Reactor_Base.cpp | 18 +++++++++--------- ACE/ace/Select_Reactor_T.cpp | 12 +++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ACE/ChangeLog b/ACE/ChangeLog index c89bc1aff51..1f20093a72a 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,9 @@ +Tue Aug 8 08:06:12 UTC 2006 Johnny Willemsen + + * ace/Select_Reactor_Base.cpp: + * ace/Select_Reactor_T.cpp: + Const improvements, use bool when possible + Tue Aug 8 07:46:12 UTC 2006 Johnny Willemsen * bin/generate_rel_manpages: diff --git a/ACE/ace/Select_Reactor_Base.cpp b/ACE/ace/Select_Reactor_Base.cpp index 75f3efb2d19..471f20dbf55 100644 --- a/ACE/ace/Select_Reactor_Base.cpp +++ b/ACE/ace/Select_Reactor_Base.cpp @@ -435,7 +435,7 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, } - int requires_reference_counting = + bool const requires_reference_counting = event_handler->reference_counting_policy ().value () == ACE_Event_Handler::Reference_Counting_Policy::ENABLED; @@ -842,10 +842,10 @@ ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *event_handler, } #endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - ssize_t n = ACE::send (this->notification_pipe_.write_handle (), - (char *) &buffer, - sizeof buffer, - timeout); + ssize_t const n = ACE::send (this->notification_pipe_.write_handle (), + (char *) &buffer, + sizeof buffer, + timeout); if (n == -1) return -1; @@ -864,7 +864,7 @@ ACE_Select_Reactor_Notify::dispatch_notifications (int &number_of_active_handles { ACE_TRACE ("ACE_Select_Reactor_Notify::dispatch_notifications"); - ACE_HANDLE read_handle = + ACE_HANDLE const read_handle = this->notification_pipe_.read_handle (); if (read_handle != ACE_INVALID_HANDLE @@ -969,7 +969,7 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) ACE_Event_Handler *event_handler = buffer.eh_; - int requires_reference_counting = + bool const requires_reference_counting = event_handler->reference_counting_policy ().value () == ACE_Event_Handler::Reference_Counting_Policy::ENABLED; @@ -1017,14 +1017,14 @@ ACE_Select_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle, { ACE_TRACE ("ACE_Select_Reactor_Notify::read_notify_pipe"); - ssize_t n = ACE::recv (handle, (char *) &buffer, sizeof buffer); + ssize_t const n = ACE::recv (handle, (char *) &buffer, sizeof buffer); if (n > 0) { // Check to see if we've got a short read. if (n != sizeof buffer) { - ssize_t remainder = sizeof buffer - n; + ssize_t const remainder = sizeof buffer - n; // If so, try to recover by reading the remainder. If this // doesn't work we're in big trouble since the input stream diff --git a/ACE/ace/Select_Reactor_T.cpp b/ACE/ace/Select_Reactor_T.cpp index 9274124490a..6619459c449 100644 --- a/ACE/ace/Select_Reactor_T.cpp +++ b/ACE/ace/Select_Reactor_T.cpp @@ -151,7 +151,7 @@ template int ACE_Select_Reactor_T::restart (int r) { ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - int current_value = this->restart_; + int const current_value = this->restart_; this->restart_ = r; return current_value; } @@ -213,13 +213,11 @@ ACE_Select_Reactor_T::notify (ACE_Event_Handler *eh, { ACE_TRACE ("ACE_Select_Reactor_T::notify"); - ssize_t n = 0; - // Pass over both the Event_Handler *and* the mask to allow the // caller to dictate which Event_Handler method the receiver // invokes. Note that this call can timeout. - n = this->notify_handler_->notify (eh, mask, timeout); + ssize_t n = this->notify_handler_->notify (eh, mask, timeout); return n == -1 ? -1 : 0; } @@ -810,7 +808,7 @@ ACE_Select_Reactor_T::notify_handle if (event_handler == 0) return; - int reference_counting_required = + bool const reference_counting_required = event_handler->reference_counting_policy ().value () == ACE_Event_Handler::Reference_Counting_Policy::ENABLED; @@ -1045,10 +1043,10 @@ ACE_Select_Reactor_T::work_pending this->timer_queue_->calculate_timeout (&mwt, &timer_buf); // Check if we have timers to fire. - int timers_pending = + int const timers_pending = (this_timeout != 0 && *this_timeout != mwt ? 1 : 0); - u_long width = (u_long) this->handler_rep_.max_handlep1 (); + u_long const width = (u_long) this->handler_rep_.max_handlep1 (); ACE_Select_Reactor_Handle_Set fd_set; fd_set.rd_mask_ = this->wait_set_.rd_mask_; -- cgit v1.2.1