From: Amos Jeffries Date: Sun, 26 Jun 2016 10:41:32 +0000 (+1200) Subject: Rename CtoCppDtor() as UniaryFunctor() X-Git-Tag: SQUID_4_0_13~39^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ec728ac854ae306643ffd2accd8981209237bac;p=thirdparty%2Fsquid.git Rename CtoCppDtor() as UniaryFunctor() Update the filename, and output functor name suffix to match. --- diff --git a/src/base/CtoCppDtor.h b/src/base/MakeFunctor.h similarity index 54% rename from src/base/CtoCppDtor.h rename to src/base/MakeFunctor.h index 31f8bfb006..836c6b27ea 100644 --- a/src/base/CtoCppDtor.h +++ b/src/base/MakeFunctor.h @@ -6,20 +6,18 @@ * Please see the COPYING and CONTRIBUTORS files for details. */ -#ifndef SQUID_BASE_CTOCPPDTOR_H -#define SQUID_BASE_CTOCPPDTOR_H +#ifndef SQUID_BASE_MAKEFUNCTOR_H +#define SQUID_BASE_MAKEFUNCTOR_H -#include - -// Macro to be used to define the C++ equivalent functor of an extern "C" -// function. The C++ functor is suffixed with the _cpp extension -#define CtoCppDtor(function, argument_type) \ - struct function ## _cpp { \ +// Macro to be used to define a C++ functor of an extern "C" +// function. The C++ functor is suffixed with the _functor extension +#define UniaryFunctor(function, argument_type) \ + struct function ## _functor { \ void operator()(argument_type a) { function(a); } \ } /// DeAllocator functor for pointers that need free(3) from the std C library -CtoCppDtor(xfree, char *); +UniaryFunctor(xfree, char *); -#endif // SQUID_BASE_CTOCPPDTOR_H +#endif // SQUID_BASE_MAKEFUNCTOR_H diff --git a/src/base/Makefile.am b/src/base/Makefile.am index 1c03ae7351..1b309863ef 100644 --- a/src/base/Makefile.am +++ b/src/base/Makefile.am @@ -24,12 +24,12 @@ libbase_la_SOURCES = \ CbDataList.h \ CharacterSet.h \ CharacterSet.cc \ - CtoCppDtor.h \ EnumIterator.h \ InstanceId.h \ Lock.h \ LookupTable.h \ LruMap.h \ + MakeFunctor.h \ Packable.h \ PackableStream.h \ RegexPattern.cc \ diff --git a/src/security/Session.h b/src/security/Session.h index 2781c2b09e..e2c4d45318 100644 --- a/src/security/Session.h +++ b/src/security/Session.h @@ -9,9 +9,11 @@ #ifndef SQUID_SRC_SECURITY_SESSION_H #define SQUID_SRC_SECURITY_SESSION_H -#include "base/CtoCppDtor.h" +#include "base/MakeFunctor.h" #include "security/LockingPointer.h" +#include + #if USE_OPENSSL #if HAVE_OPENSSL_SSL_H #include @@ -33,12 +35,12 @@ typedef LockingPointer SessionPoin #elif USE_GNUTLS typedef gnutls_session_t SessionPtr; -CtoCppDtor(gnutls_deinit, gnutls_session_t); +UniaryFunctor(gnutls_deinit, gnutls_session_t); // TODO: Convert to Locking pointer. // Locks can be implemented attaching locks counter to gnutls_session_t // objects using the gnutls_session_set_ptr()/gnutls_session_get_ptr () // library functions -typedef std::unique_ptr SessionPointer; +typedef std::unique_ptr SessionPointer; #else // use void* so we can check against NULL diff --git a/src/ssl/gadgets.h b/src/ssl/gadgets.h index 4ee85160af..a662a0b0bb 100644 --- a/src/ssl/gadgets.h +++ b/src/ssl/gadgets.h @@ -47,44 +47,44 @@ typedef std::unique_ptr X509_STACK_Pointer CtoCpp1(EVP_PKEY_free, EVP_PKEY *) typedef Security::LockingPointer EVP_PKEY_Pointer; -CtoCppDtor(BN_free, BIGNUM *); -typedef std::unique_ptr BIGNUM_Pointer; +UniaryFunctor(BN_free, BIGNUM *); +typedef std::unique_ptr BIGNUM_Pointer; -CtoCppDtor(BIO_free, BIO *); -typedef std::unique_ptr BIO_Pointer; +UniaryFunctor(BIO_free, BIO *); +typedef std::unique_ptr BIO_Pointer; -CtoCppDtor(ASN1_INTEGER_free, ASN1_INTEGER *); -typedef std::unique_ptr ASN1_INT_Pointer; +UniaryFunctor(ASN1_INTEGER_free, ASN1_INTEGER *); +typedef std::unique_ptr ASN1_INT_Pointer; -CtoCppDtor(ASN1_OCTET_STRING_free, ASN1_OCTET_STRING *); -typedef std::unique_ptr ASN1_OCTET_STRING_Pointer; +UniaryFunctor(ASN1_OCTET_STRING_free, ASN1_OCTET_STRING *); +typedef std::unique_ptr ASN1_OCTET_STRING_Pointer; -CtoCppDtor(TXT_DB_free, TXT_DB *); -typedef std::unique_ptr TXT_DB_Pointer; +UniaryFunctor(TXT_DB_free, TXT_DB *); +typedef std::unique_ptr TXT_DB_Pointer; -CtoCppDtor(X509_NAME_free, X509_NAME *); -typedef std::unique_ptr X509_NAME_Pointer; +UniaryFunctor(X509_NAME_free, X509_NAME *); +typedef std::unique_ptr X509_NAME_Pointer; -CtoCppDtor(RSA_free, RSA *); -typedef std::unique_ptr RSA_Pointer; +UniaryFunctor(RSA_free, RSA *); +typedef std::unique_ptr RSA_Pointer; -CtoCppDtor(X509_REQ_free, X509_REQ *); -typedef std::unique_ptr X509_REQ_Pointer; +UniaryFunctor(X509_REQ_free, X509_REQ *); +typedef std::unique_ptr X509_REQ_Pointer; sk_dtor_wrapper(sk_X509_NAME, STACK_OF(X509_NAME) *, X509_NAME_free); typedef std::unique_ptr X509_NAME_STACK_Pointer; -CtoCppDtor(AUTHORITY_KEYID_free, AUTHORITY_KEYID *); -typedef std::unique_ptr AUTHORITY_KEYID_Pointer; +UniaryFunctor(AUTHORITY_KEYID_free, AUTHORITY_KEYID *); +typedef std::unique_ptr AUTHORITY_KEYID_Pointer; sk_dtor_wrapper(sk_GENERAL_NAME, STACK_OF(GENERAL_NAME) *, GENERAL_NAME_free); typedef std::unique_ptr GENERAL_NAME_STACK_Pointer; -CtoCppDtor(GENERAL_NAME_free, GENERAL_NAME *); -typedef std::unique_ptr GENERAL_NAME_Pointer; +UniaryFunctor(GENERAL_NAME_free, GENERAL_NAME *); +typedef std::unique_ptr GENERAL_NAME_Pointer; -CtoCppDtor(X509_EXTENSION_free, X509_EXTENSION *); -typedef std::unique_ptr X509_EXTENSION_Pointer; +UniaryFunctor(X509_EXTENSION_free, X509_EXTENSION *); +typedef std::unique_ptr X509_EXTENSION_Pointer; /** \ingroup SslCrtdSslAPI