Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit d6ccedb2 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

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
parent 211ba627
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment