From: Amos Jeffries Date: Tue, 28 Jun 2016 12:57:49 +0000 (+1200) Subject: security_file_certgen: convert xfree_char to UnaryFunctor xfree_functor X-Git-Tag: SQUID_4_0_13~39^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c8b016dd8d0e78f27148803111ad095ea98b8d2;p=thirdparty%2Fsquid.git security_file_certgen: convert xfree_char to UnaryFunctor xfree_functor --- diff --git a/src/security/cert_generators/file/certificate_db.cc b/src/security/cert_generators/file/certificate_db.cc index a2d577a789..41f6fbd271 100644 --- a/src/security/cert_generators/file/certificate_db.cc +++ b/src/security/cert_generators/file/certificate_db.cc @@ -7,6 +7,7 @@ */ #include "squid.h" +#include "base/MakeFunctor.h" #include "security/cert_generators/file/certificate_db.h" #include @@ -282,11 +283,6 @@ bool Ssl::CertificateDb::purgeCert(std::string const & key) { return true; } -/// DeAllocator functor for unique_ptr that need free(3) from the std C library -struct xfree_char { - void operator()(char *a) { xfree(a); } -}; - bool Ssl::CertificateDb::addCertAndPrivateKey(Security::CertPointer & cert, Ssl::EVP_PKEY_Pointer & pkey, std::string const & useName) { const Locker locker(dbLock, Here); load(); @@ -297,7 +293,7 @@ bool Ssl::CertificateDb::addCertAndPrivateKey(Security::CertPointer & cert, Ssl: std::string serial_string; Ssl::BIGNUM_Pointer serial(ASN1_INTEGER_to_BN(ai, NULL)); { - std::unique_ptr hex_bn(BN_bn2hex(serial.get())); + std::unique_ptr hex_bn(BN_bn2hex(serial.get())); serial_string = std::string(hex_bn.get()); } row.setValue(cnlSerial, serial_string.c_str()); @@ -310,7 +306,7 @@ bool Ssl::CertificateDb::addCertAndPrivateKey(Security::CertPointer & cert, Ssl: } { - std::unique_ptr subject(X509_NAME_oneline(X509_get_subject_name(cert.get()), nullptr, 0)); + std::unique_ptr subject(X509_NAME_oneline(X509_get_subject_name(cert.get()), nullptr, 0)); Security::CertPointer findCert; Ssl::EVP_PKEY_Pointer findPkey; if (pure_find(useName.empty() ? subject.get() : useName, findCert, findPkey)) { @@ -353,7 +349,7 @@ bool Ssl::CertificateDb::addCertAndPrivateKey(Security::CertPointer & cert, Ssl: if (!useName.empty()) row.setValue(cnlName, useName.c_str()); else { - std::unique_ptr subject(X509_NAME_oneline(X509_get_subject_name(cert.get()), nullptr, 0)); + std::unique_ptr subject(X509_NAME_oneline(X509_get_subject_name(cert.get()), nullptr, 0)); row.setValue(cnlName, subject.get()); }