]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
use decltype to avoid spelling out the cleanup function type
authorOtto <otto.moerbeek@open-xchange.com>
Fri, 17 Dec 2021 09:16:12 +0000 (10:16 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Fri, 17 Dec 2021 09:16:12 +0000 (10:16 +0100)
pdns/sha.hh

index 30b83ad8b4a4f305a1ff7bb0dafc6b3655d56d48..b9c8ff5fb9d95b7e525dd501602473f00e344e1e 100644 (file)
@@ -59,7 +59,7 @@ class SHADigest
 {
 public:
   SHADigest(unsigned int bits) :
-    mdctx(std::unique_ptr<EVP_MD_CTX, void (*)(EVP_MD_CTX*)>(EVP_MD_CTX_new(), EVP_MD_CTX_free))
+    mdctx(std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)>(EVP_MD_CTX_new(), EVP_MD_CTX_free))
   {
     if (mdctx == nullptr) {
       throw std::runtime_error("SHADigest: EVP_MD_CTX_new failed");
@@ -109,7 +109,7 @@ public:
   }
 
 private:
-  std::unique_ptr<EVP_MD_CTX, void (*)(EVP_MD_CTX*)> mdctx;
+  std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)> mdctx;
   const EVP_MD* md;
 };
 }