remove fragile union design
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 19 Jan 2020 01:07:55 +0000 (18:07 -0700)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 19 Jan 2020 02:59:24 +0000 (19:59 -0700)
Absurd to be memory-conscious about a couple of member variables in an object that represents user input

libs/ardour/ardour/transport_fsm.h

index 86133e77c5605a4f5fda6b1f3f2937402dc77e9a..7f6728da07b780ee9ad7b582dcd0b27885b6dc0f 100644 (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)