Slightly cleanup code of preload hooks.
authorMilian Wolff <mail@milianw.de>
Wed, 8 Jun 2016 13:08:16 +0000 (15:08 +0200)
committerMilian Wolff <mail@milianw.de>
Wed, 8 Jun 2016 13:08:16 +0000 (15:08 +0200)
We instantiate directly with the decltype of a function
pointer now, so thereis no need to construct the pointer
via a secondary type anymore.

heaptrack_preload.cpp

index 443e17a..142f84f 100644 (file)
@@ -36,10 +36,9 @@ namespace {
 
 namespace hooks {
 
-template<typename SignatureT, typename Base>
+template<typename Signature, typename Base>
 struct hook
 {
-    using Signature = SignatureT*;
     Signature original = nullptr;
 
     void init() noexcept
@@ -64,7 +63,7 @@ struct hook
     }
 };
 
-#define HOOK(name) struct name ## _t : public hook<decltype(::name), name ## _t> { \
+#define HOOK(name) struct name ## _t : public hook<decltype(&::name), name ## _t> { \
     static constexpr const char* identifier = #name; } name
 
 HOOK(malloc);