Skip to content

Commit fac95fd

Browse files
committed
Improve code for multiple actions handling
1 parent a928f2f commit fac95fd

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

include/cpp_event_framework/Statemachine.hxx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,15 @@ public:
224224
{
225225
target_ = rhs.target_;
226226
single_action_ = rhs.single_action_;
227-
if (single_action_ == nullptr)
227+
if (single_action_ != nullptr)
228228
{
229-
// external buffer was supplied or no action at all
230-
actions_ = rhs.actions_;
229+
// internal buffer was used
230+
actions_ = {&single_action_, 1};
231231
}
232232
else
233233
{
234-
// internal buffer was used, but size may be 1 or 0
235-
actions_ = {&single_action_, rhs.actions_.size()};
234+
// external buffer was supplied or no action at all
235+
actions_ = rhs.actions_;
236236
}
237237
}
238238

@@ -329,25 +329,25 @@ public:
329329
on_single_entry_ = rhs.on_single_exit_;
330330
on_single_exit_ = rhs.on_single_exit_;
331331
flags_ = rhs.flags_;
332-
if (on_single_entry_ == nullptr)
332+
if (on_single_entry_ != nullptr)
333333
{
334-
// external buffer was supplied or no action at all
335-
on_entry_ = rhs.on_entry_;
334+
// internal buffer was used
335+
on_entry_ = {&on_single_entry_, 1};
336336
}
337337
else
338338
{
339-
// internal buffer was used, but size may be 1 or 0
340-
on_entry_ = {&on_single_entry_, rhs.on_entry_.size()};
339+
// external buffer was supplied or no action at all
340+
on_entry_ = rhs.on_entry_;
341341
}
342-
if (on_single_exit_ == nullptr)
342+
if (on_single_exit_ != nullptr)
343343
{
344-
// external buffer was supplied or no action at all
345-
on_exit_ = rhs.on_exit_;
344+
// internal buffer was used
345+
on_exit_ = {&on_single_exit_, 1};
346346
}
347347
else
348348
{
349-
// internal buffer was used, but size may be 1 or 0
350-
on_exit_ = {&on_single_exit_, rhs.on_exit_.size()};
349+
// external buffer was supplied or no action at all
350+
on_exit_ = rhs.on_exit_;
351351
}
352352
}
353353

0 commit comments

Comments
 (0)