TouchInputMapper: Rely on default c'tor and copy c'tors for structs
Manually defining copyFrom(), reset(), and clear() operations on structs that should be POD types is errorprone, since each member must be copied or reinitialized correctly in all of them. Also, default-initialization can leave many of these non-class values in an undefined state. Instead, we can rely on initializing members wherever they are defined, which allows us to remove manually added c'tors and copy functions and rely on the compiler generated equivalents. This also reduces the liklihood of issues arising because of uninitialized data. We prefer brace initialization over other forms of initialization. Using braces for all types results in the most consistent behavior of calling the default c'tor for class types, and 0-initializing non class types. Bug: 245989146 Test: atest inputflinger_tests Change-Id: I0b34480ec441bd06097a626ff4c6dc5d2e046e38
Loading
Please register or sign in to comment