From: Christos Tsantilas Date: Fri, 9 Sep 2016 08:59:21 +0000 (+0300) Subject: Siplify Ssl::CertError class X-Git-Tag: SQUID_4_0_15~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ccc348a58aa6c417accbcef9db979edebbe35333;p=thirdparty%2Fsquid.git Siplify Ssl::CertError class - Remove CertError copy constructor and assignment operator. The compiler generated versions are enough. - Implement equality operators as C++ inlined members --- diff --git a/src/ssl/support.cc b/src/ssl/support.cc index b78a3f29f9..bd28f5539f 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -1453,32 +1453,6 @@ Ssl::CertError::CertError(ssl_error_t anErr, X509 *aCert, int aDepth): code(anEr cert.resetAndLock(aCert); } -Ssl::CertError::CertError(CertError const &err): code(err.code), depth(err.depth) -{ - cert.resetAndLock(err.cert.get()); -} - -Ssl::CertError & -Ssl::CertError::operator = (const CertError &old) -{ - code = old.code; - depth = old.depth; - cert.resetAndLock(old.cert.get()); - return *this; -} - -bool -Ssl::CertError::operator == (const CertError &ce) const -{ - return code == ce.code && cert.get() == ce.cert.get() && depth == ce.depth; -} - -bool -Ssl::CertError::operator != (const CertError &ce) const -{ - return code != ce.code || cert.get() != ce.cert.get() || depth != ce.depth; -} - static int store_session_cb(SSL *ssl, SSL_SESSION *session) { diff --git a/src/ssl/support.h b/src/ssl/support.h index f521deb82d..47012a44b6 100644 --- a/src/ssl/support.h +++ b/src/ssl/support.h @@ -100,10 +100,14 @@ public: */ int depth; CertError(ssl_error_t anErr, X509 *aCert, int depth = -1); - CertError(CertError const &err); - CertError & operator = (const CertError &old); - bool operator == (const CertError &ce) const; - bool operator != (const CertError &ce) const; + bool operator == (const CertError &ce) const { + // We expect to be used in contexts where identical certificates have + // identical pointers. + return code == ce.code && depth == ce.depth && cert.get() == ce.cert.get(); + } + bool operator != (const CertError &ce) const { + return !(*this == ce); + } }; /// Holds a list of certificate SSL errors