]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Siplify Ssl::CertError class
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 9 Sep 2016 08:59:21 +0000 (11:59 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 9 Sep 2016 08:59:21 +0000 (11:59 +0300)
 - Remove CertError copy constructor and assignment operator. The compiler
   generated versions are enough.
 - Implement equality operators as C++ inlined members

src/ssl/support.cc
src/ssl/support.h

index b78a3f29f927e1b6d008f3c779b246a3a7b19acd..bd28f5539f7ec2369ed53e6006a8f368fa3609df 100644 (file)
@@ -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)
 {
index f521deb82d2f158e7d35c7a030a6d9947aed651f..47012a44b6fbd61b458afd94494dfd8ad0d8289b 100644 (file)
@@ -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