Refactor code to remove reliance on undefined behavior.
authorMilian Wolff <mail@milianw.de>
Wed, 8 Jun 2016 15:16:27 +0000 (17:16 +0200)
committerMilian Wolff <mail@milianw.de>
Wed, 8 Jun 2016 15:16:27 +0000 (17:16 +0200)
commitbb9a54a6f606bd9b1acb9407e4246d7626fb5c2e
tree6ab959cee02eac7e61ef4e8b7eb923ddc4ba3d74
parent10d1d69557f885c59cc9eea04a0f26f21152314a
Refactor code to remove reliance on undefined behavior.

Previously, the code got away with a c-style reinterpret_cast
in a constexpr function, which is not allowed according to the
standard. I think I was just lucky that the compiler didn't saw
through that yet.

Also, the code assumed (and enforced) that all function pointers
are sizeof(void*), which worked, but was a bit clunky.

Now, we simply get rid of the list of addresses, and iterate
manually over all hooks. With C++17's apply, this could be implemented
even nicer with a tuple and std::apply. That doesn't exist yet, so
we manually call the functions.
heaptrack_inject.cpp