Skip to content

Commit b812fad

Browse files
committed
Replace typedef with using in libsecurity API
1 parent a62833e commit b812fad

15 files changed

Lines changed: 53 additions & 69 deletions

src/security/Context.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,14 @@
2626
namespace Security {
2727

2828
#if USE_OPENSSL
29-
typedef std::shared_ptr<SSL_CTX> ContextPointer;
30-
29+
using ContextPointer = std::shared_ptr<SSL_CTX>;
3130
#elif HAVE_LIBGNUTLS
32-
typedef std::shared_ptr<struct gnutls_certificate_credentials_st> ContextPointer;
33-
31+
using ContextPointer = std::shared_ptr<struct gnutls_certificate_credentials_st>;
3432
#else
3533
// use void* so we can check against nullptr
36-
typedef std::shared_ptr<void> ContextPointer;
37-
34+
using ContextPointer = std::shared_ptr<void>;
3835
#endif
3936

4037
} // namespace Security
4138

4239
#endif /* SQUID_SRC_SECURITY_CONTEXT_H */
43-

src/security/ErrorDetail.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
namespace Security {
3232

3333
// we use std::map to optimize search; TODO: Use std::unordered_map instead?
34-
typedef std::map<ErrorCode, const char *> ErrorCodeNames;
34+
using ErrorCodeNames = std::map<ErrorCode, const char *>;
3535
static const ErrorCodeNames TheErrorCodeNames = {
3636
{ SQUID_TLS_ERR_ACCEPT,
3737
"SQUID_TLS_ERR_ACCEPT"

src/security/ErrorDetail.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ErrorDetail: public ::ErrorDetail
4141
MEMPROXY_CLASS(Security::ErrorDetail);
4242

4343
public:
44-
typedef ErrorDetailPointer Pointer;
44+
using Pointer = ErrorDetailPointer;
4545

4646
/// Details an origin or cache_peer certificate verification failure or mismatch.
4747
/// \param peer is an origin server or cache_peer certificate

src/security/Handshake.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ static const uint64_t HelloRandomSize = 32;
9191
class Extension
9292
{
9393
public:
94-
typedef uint16_t Type;
94+
using Type = uint16_t;
95+
9596
explicit Extension(Parser::BinaryTokenizer &tk);
9697

9798
/// whether this extension is supported by Squid and, hence, may be bumped
@@ -103,7 +104,7 @@ class Extension
103104
};
104105

105106
/// Extension types optimized for fast lookups.
106-
typedef std::unordered_set<Extension::Type> Extensions;
107+
using Extensions = std::unordered_set<Extension::Type>;
107108
static Extensions SupportedExtensions();
108109

109110
/// parse TLS ProtocolVersion (uint16) and convert it to AnyP::ProtocolVersion

src/security/Handshake.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ namespace Security
2222
class TlsDetails: public RefCountable
2323
{
2424
public:
25-
typedef RefCount<TlsDetails> Pointer;
25+
using Ciphers = std::unordered_set<uint16_t>;
26+
using Pointer = RefCount<TlsDetails>;
2627

2728
TlsDetails();
2829
/// Prints to os stream a human readable form of TlsDetails object
@@ -45,8 +46,6 @@ class TlsDetails: public RefCountable
4546
/// The client random number
4647
SBuf clientRandom;
4748
SBuf sessionId;
48-
49-
typedef std::unordered_set<uint16_t> Ciphers;
5049
Ciphers ciphers;
5150
};
5251

src/security/Io.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Security {
1919
template <typename Fun>
2020
static IoResult Handshake(Comm::Connection &, ErrorCode, Fun);
2121

22-
typedef SessionPointer::element_type *ConnectionPointer;
22+
using ConnectionPointer = SessionPointer::element_type *;
2323

2424
} // namespace Security
2525

src/security/Io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Security {
1818
/// a summary a TLS I/O operation outcome
1919
class IoResult: public RefCountable {
2020
public:
21-
typedef RefCount<IoResult> Pointer;
21+
using Pointer = RefCount<IoResult>;
2222

2323
/// all possible outcome cases
2424
typedef enum { ioSuccess, ioWantRead, ioWantWrite, ioError } Category;

src/security/KeyLogger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <iosfwd>
1616

1717
class MasterXaction;
18-
typedef RefCount<MasterXaction> MasterXactionPointer;
18+
using MasterXactionPointer = RefCount<MasterXaction>;
1919

2020
namespace Security {
2121

src/security/LockingPointer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace Security
3434
{
3535

3636
inline bool nilFunction(const void *) { return false; }
37-
typedef HardFun<bool, const void *, nilFunction> NilFunctor;
37+
using NilFunctor = HardFun<bool, const void *, nilFunction>;
3838

3939
/**
4040
* A shared pointer to a reference-counting Object with library-specific
@@ -51,7 +51,7 @@ class LockingPointer
5151
{
5252
public:
5353
/// a helper label to simplify this objects API definitions below
54-
typedef Security::LockingPointer<T, UnLocker, Locker> SelfType;
54+
using SelfType = Security::LockingPointer<T, UnLocker, Locker>;
5555

5656
/// constructs a nil smart pointer
5757
constexpr LockingPointer(): raw(nullptr) {}

src/security/PeerConnector.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Security::PeerConnector::PeerConnector(const Comm::ConnectionPointer &aServerCon
5353
// watch for external connection closures
5454
Must(Comm::IsConnOpen(serverConn));
5555
Must(!fd_table[serverConn->fd].closing());
56-
typedef CommCbMemFunT<Security::PeerConnector, CommCloseCbParams> Dialer;
56+
using Dialer = CommCbMemFunT<Security::PeerConnector, CommCloseCbParams>;
5757
closeHandler = JobCallback(9, 5, Dialer, this, Security::PeerConnector::commCloseHandler);
5858
comm_add_close_handler(serverConn->fd, closeHandler);
5959
}
@@ -467,9 +467,8 @@ Security::PeerConnector::noteWantRead()
467467
const int fd = serverConnection()->fd;
468468

469469
// read timeout to avoid getting stuck while reading from a silent server
470-
typedef CommCbMemFunT<Security::PeerConnector, CommTimeoutCbParams> TimeoutDialer;
471-
AsyncCall::Pointer timeoutCall = JobCallback(83, 5,
472-
TimeoutDialer, this, Security::PeerConnector::commTimeoutHandler);
470+
using TimeoutDialer = CommCbMemFunT<Security::PeerConnector, CommTimeoutCbParams>;
471+
AsyncCall::Pointer timeoutCall = JobCallback(83, 5, TimeoutDialer, this, Security::PeerConnector::commTimeoutHandler);
473472
const auto timeout = Comm::MortalReadTimeout(startTime, negotiationTimeout);
474473
commSetConnTimeout(serverConnection(), timeout, timeoutCall);
475474

0 commit comments

Comments
 (0)