remove fragile union design

Absurd to be memory-conscious about a couple of member variables in an object that represents user input
This commit is contained in:
Paul Davis
2020-01-18 18:07:55 -07:00
parent d83cd05882
commit 620ab66e75

View File

@@ -44,21 +44,20 @@ struct TransportFSM
struct Event : public boost::intrusive::list_base_hook<> {
EventType type;
union {
bool abort; /* for stop */
LocateTransportDisposition ltd; /* for locate */
};
union {
bool clear_state; /* for stop */
bool with_flush; /* for locate */
};
/* for stop */
bool abort;
bool clear_state;
/* for locate */
LocateTransportDisposition ltd;
bool with_flush;
samplepos_t target;
bool for_loop_end;
bool force;
Event (EventType t)
: type (t)
, abort (false)
, clear_state (false)
, ltd (MustStop)
, with_flush (false)
, target (0)
@@ -72,11 +71,18 @@ struct TransportFSM
: type (t)
, abort (ab)
, clear_state (cl)
, ltd (MustStop)
, with_flush (false)
, target (0)
, for_loop_end (false)
, force (false)
{
assert (t == StopTransport);
}
Event (EventType t, samplepos_t pos, LocateTransportDisposition l, bool fl, bool lp, bool f4c)
: type (t)
, abort (false)
, clear_state (false)
, ltd (l)
, with_flush (fl)
, target (pos)