Skip to content

Commit 4d74f4c

Browse files
authored
Merge pull request #2497 from jwillemsen/jwi-modernexam
Use nullptr/default/override
2 parents 3b55e85 + eaf89a8 commit 4d74f4c

File tree

2 files changed

+17
-33
lines changed

2 files changed

+17
-33
lines changed

ACE/examples/Reactor/WFMO_Reactor/Registration.cpp

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
*/
2525
//=============================================================================
2626

27-
2827
#include "ace/OS_main.h"
2928

3029
#if defined (ACE_WIN32)
@@ -34,41 +33,31 @@
3433
#include "ace/OS_NS_unistd.h"
3534
#include "ace/Log_Msg.h"
3635

37-
3836
// Globals for this test
39-
int stop_test = 0;
37+
bool stop_test = false;
4038
ACE_Reactor reactor;
4139

42-
4340
class Simple_Handler : public ACE_Event_Handler
4441
{
4542
public:
46-
/// Default constructor
47-
Simple_Handler ();
43+
Simple_Handler () = default;
4844

49-
virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0);
50-
virtual int handle_close (ACE_HANDLE handle,
51-
ACE_Reactor_Mask close_mask);
45+
int handle_signal (int signum, siginfo_t * = nullptr, ucontext_t * = nullptr) override;
46+
int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) override;
5247

5348
ACE_Auto_Event event1_;
5449
ACE_Auto_Event event2_;
55-
int handle_signal_count_;
56-
int handle_close_count_;
50+
int handle_signal_count_ {};
51+
int handle_close_count_ {};
5752
};
5853

59-
Simple_Handler::Simple_Handler ()
60-
: handle_signal_count_ (0),
61-
handle_close_count_ (0)
62-
{
63-
}
64-
6554
int
6655
Simple_Handler::handle_signal (int, siginfo_t *s, ucontext_t *)
6756
{
68-
ACE_HANDLE handle = s->si_handle_;
57+
ACE_HANDLE const handle = s->si_handle_;
6958
ACE_UNUSED_ARG (handle);
7059

71-
this->handle_signal_count_++;
60+
++this->handle_signal_count_;
7261

7362
if (this->handle_signal_count_ == 1)
7463
this->reactor ()->suspend_handler (event1_.handle ());
@@ -79,25 +68,22 @@ Simple_Handler::handle_signal (int, siginfo_t *s, ucontext_t *)
7968
}
8069
else if (this->handle_signal_count_ == 3)
8170
{
82-
this->reactor ()->remove_handler (event1_.handle (),
83-
ACE_Event_Handler::NULL_MASK);
84-
this->reactor ()->remove_handler (event2_.handle (),
85-
ACE_Event_Handler::NULL_MASK);
71+
this->reactor ()->remove_handler (event1_.handle (), ACE_Event_Handler::NULL_MASK);
72+
this->reactor ()->remove_handler (event2_.handle (), ACE_Event_Handler::NULL_MASK);
8673
}
8774
return 0;
8875
}
8976

9077
int
91-
Simple_Handler::handle_close (ACE_HANDLE handle,
92-
ACE_Reactor_Mask)
78+
Simple_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask)
9379
{
9480
ACE_DEBUG ((LM_DEBUG, "Simple_Handler::handle_close handle = %d\n", handle));
95-
this->handle_close_count_++;
81+
++this->handle_close_count_;
9682

9783
if (this->handle_close_count_ == 1)
98-
stop_test = 0;
84+
stop_test = false;
9985
else if (this->handle_close_count_ == 2)
100-
stop_test = 1;
86+
stop_test = true;
10187

10288
return 0;
10389
}
@@ -134,12 +120,10 @@ worker ()
134120
int
135121
ACE_TMAIN (int, ACE_TCHAR *[])
136122
{
137-
int result = reactor.register_handler (&simple_handler,
138-
simple_handler.event1_.handle ());
123+
int result = reactor.register_handler (&simple_handler, simple_handler.event1_.handle ());
139124
ACE_TEST_ASSERT (result == 0);
140125

141-
result = reactor.register_handler (&simple_handler,
142-
simple_handler.event2_.handle ());
126+
result = reactor.register_handler (&simple_handler, simple_handler.event2_.handle ());
143127
ACE_TEST_ASSERT (result == 0);
144128

145129
result = ACE_OS::thr_create ((ACE_THR_FUNC) worker, 0, 0, 0);

ACE/tests/Bug_2820_Regression_Test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ run_main (int, ACE_TCHAR *[])
7777
v->add_reference();
7878

7979
// Only our explicit calls to add_reference() should be reflected in
80-
// the refence_count...
80+
// the reference_count...
8181
if (pos_release_count != pre_notify_count + 2)
8282
{
8383
result = -1;

0 commit comments

Comments
 (0)