From 9fa9dc54c2aa83c1341ba742d8474dc9f4871690 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 19:45:22 +0530 Subject: [PATCH 01/43] src: replace typedef with using in aliased_buffer.h --- src/aliased_buffer.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aliased_buffer.h b/src/aliased_buffer.h index 53011c5fe0af25..6a4e9b4a9ca94b 100644 --- a/src/aliased_buffer.h +++ b/src/aliased_buffer.h @@ -10,7 +10,7 @@ namespace node { -typedef size_t AliasedBufferIndex; +using AliasedBufferIndex = size_t; /** * Do not use this class directly when creating instances of it - use the @@ -304,11 +304,11 @@ class AliasedBufferBase { const AliasedBufferIndex* index_ = nullptr; }; -typedef AliasedBufferBase AliasedInt32Array; -typedef AliasedBufferBase AliasedUint8Array; -typedef AliasedBufferBase AliasedUint32Array; -typedef AliasedBufferBase AliasedFloat64Array; -typedef AliasedBufferBase AliasedBigUint64Array; +using AliasedInt32Array = AliasedBufferBase; +using AliasedUint8Array = AliasedBufferBase; +using AliasedUint32Array = AliasedBufferBase; +using AliasedFloat64Array = AliasedBufferBase; +using AliasedBigUint64Array = AliasedBufferBase; } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS From 709a8080dc16a889171ccf9199c0f55c4d89eb6d Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 19:48:19 +0530 Subject: [PATCH 02/43] src: replace typedef with using in api/hooks.cc --- src/api/hooks.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/hooks.cc b/src/api/hooks.cc index cb46c5c1b87643..c5de7fccd6f05e 100644 --- a/src/api/hooks.cc +++ b/src/api/hooks.cc @@ -87,8 +87,8 @@ Maybe EmitProcessExit(Environment* env) { return Just(code); } -typedef void (*CleanupHook)(void* arg); -typedef void (*AsyncCleanupHook)(void* arg, void(*)(void*), void*); +using CleanupHook = void (*)(void* arg); +using AsyncCleanupHook = void (*)(void* arg, void(*)(void*), void*); struct AsyncCleanupHookInfo final { Environment* env; From 04d75485353a69f3b158adfefc0950b5636dbbc6 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 19:49:34 +0530 Subject: [PATCH 03/43] src: replace typedef with using in crypto/crypto_cipher.h --- src/crypto/crypto_cipher.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/crypto_cipher.h b/src/crypto/crypto_cipher.h index c8dd3e48f718fd..8d3937b250c4af 100644 --- a/src/crypto/crypto_cipher.h +++ b/src/crypto/crypto_cipher.h @@ -95,8 +95,8 @@ class CipherBase : public BaseObject { class PublicKeyCipher { public: - typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX* ctx); - typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX* ctx, + using EVP_PKEY_cipher_init_t = int (*)(EVP_PKEY_CTX* ctx); + using EVP_PKEY_cipher_t = int (*)(EVP_PKEY_CTX* ctx, unsigned char* out, size_t* outlen, const unsigned char* in, size_t inlen); From 8dfa19f0a0b24d37e2454b2ce86da1b7d0721486 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 19:50:35 +0530 Subject: [PATCH 04/43] src: replace typedef with using in crypto/crypto_clienthello.h --- src/crypto/crypto_clienthello.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/crypto_clienthello.h b/src/crypto/crypto_clienthello.h index 0d3bf60f96bc69..aaebe928099fdc 100644 --- a/src/crypto/crypto_clienthello.h +++ b/src/crypto/crypto_clienthello.h @@ -60,8 +60,8 @@ class ClientHelloParser { friend class ClientHelloParser; }; - typedef void (*OnHelloCb)(void* arg, const ClientHello& hello); - typedef void (*OnEndCb)(void* arg); + using OnHelloCb = void (*)(void* arg, const ClientHello& hello); + using OnEndCb = void (*)(void* arg); void Parse(const uint8_t* data, size_t avail); From 43f20af82f4c10fd9e5064b6fb802e1b4035a6ef Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 19:51:24 +0530 Subject: [PATCH 05/43] src: replace typedef with using in crypto/crypto_ec.cc --- src/crypto/crypto_ec.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/crypto_ec.cc b/src/crypto/crypto_ec.cc index ea4c70ad5d8c84..070502e8e5e24d 100644 --- a/src/crypto/crypto_ec.cc +++ b/src/crypto/crypto_ec.cc @@ -620,7 +620,7 @@ WebCryptoKeyExportStatus EC_Raw_Export( size_t len = 0; if (ec_key == nullptr) { - typedef int (*export_fn)(const EVP_PKEY*, unsigned char*, size_t* len); + using export_fn = int (*)(const EVP_PKEY*, unsigned char*, size_t* len); export_fn fn = nullptr; switch (key_data->GetKeyType()) { case kKeyTypePrivate: From f22484a5292ba45bab49ddbd01b0f2e6d31f53ec Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 19:58:59 +0530 Subject: [PATCH 06/43] src: replace typedef with using in crypto/crypto_groups.h --- src/crypto/crypto_groups.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/crypto_groups.h b/src/crypto/crypto_groups.h index c49b4356d8a919..71f622aa6f3e10 100644 --- a/src/crypto/crypto_groups.h +++ b/src/crypto/crypto_groups.h @@ -390,12 +390,12 @@ static const unsigned char group_modp18[] = { 0x80, 0xdd, 0x98, 0xed, 0xd3, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -typedef struct { +using modp_group = struct { const char* name; const char* prime; unsigned int prime_size; unsigned int gen; -} modp_group; +}; static const modp_group modp_groups[] = { #define V(var) reinterpret_cast(var) From 61253645646ab69898afe2671a911235602d5dae Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 19:59:29 +0530 Subject: [PATCH 07/43] src: replace typedef with using in crypto/crypto_keys.cc --- src/crypto/crypto_keys.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc index be12022bdb7f1d..399cd24bd3504b 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc @@ -1059,7 +1059,7 @@ void KeyObjectHandle::InitEDRaw(const FunctionCallbackInfo& args) { MarkPopErrorOnReturn mark_pop_error_on_return; - typedef EVP_PKEY* (*new_key_fn)(int, ENGINE*, const unsigned char*, size_t); + using new_key_fn = EVP_PKEY* (*)(int, ENGINE*, const unsigned char*, size_t); new_key_fn fn = type == kKeyTypePrivate ? EVP_PKEY_new_raw_private_key : EVP_PKEY_new_raw_public_key; From f443f2954aa5549924aa50b7e74c18cd497e2ca2 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:00:14 +0530 Subject: [PATCH 08/43] src: replace typedef with using in crypto/crypto_sig.h --- src/crypto/crypto_sig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/crypto_sig.h b/src/crypto/crypto_sig.h index fa44811c3ee44d..77f7399a375800 100644 --- a/src/crypto/crypto_sig.h +++ b/src/crypto/crypto_sig.h @@ -21,7 +21,7 @@ enum DSASigEnc { class SignBase : public BaseObject { public: - typedef enum { + using Error = enum { kSignOk, kSignUnknownDigest, kSignInit, @@ -30,7 +30,7 @@ class SignBase : public BaseObject { kSignPrivateKey, kSignPublicKey, kSignMalformedSignature - } Error; + }; SignBase(Environment* env, v8::Local wrap); From 3c039ec566b5c819befd361da7a1f2556e1ea148 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:00:50 +0530 Subject: [PATCH 09/43] src: replace typedef with using in crypto/crypto_tls.h --- src/crypto/crypto_tls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/crypto_tls.h b/src/crypto/crypto_tls.h index 6dda31d22be8a6..8cd1c6c6d3a47e 100644 --- a/src/crypto/crypto_tls.h +++ b/src/crypto/crypto_tls.h @@ -121,7 +121,7 @@ class TLSWrap : public AsyncWrap, // Maximum number of buffers passed to uv_write() static constexpr int kSimultaneousBufferCount = 10; - typedef void (*CertCb)(void* arg); + using CertCb = void (*)(void* arg); // Alternative to StreamListener::stream(), that returns a StreamBase instead // of a StreamResource. From d935dd20c6294d9f90dc832fdad277c9e8641de0 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:02:36 +0530 Subject: [PATCH 10/43] src: replace typedef with using in env.h --- src/env.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/env.h b/src/env.h index 6b8444f0bc578c..3e14b127051c7c 100644 --- a/src/env.h +++ b/src/env.h @@ -545,7 +545,7 @@ constexpr size_t kFsStatsBufferLength = class Environment; struct AllocatedBuffer; -typedef size_t SnapshotIndex; +using SnapshotIndex = size_t; class IsolateData : public MemoryRetainer { public: IsolateData(v8::Isolate* isolate, @@ -876,7 +876,7 @@ class ShouldNotAbortOnUncaughtScope { class CleanupHookCallback { public: - typedef void (*Callback)(void*); + using Callback = void (*)(void*); CleanupHookCallback(Callback fn, void* arg, @@ -912,7 +912,7 @@ struct PropInfo { SnapshotIndex index; // In the snapshot }; -typedef void (*DeserializeRequestCallback)(v8::Local context, +using DeserializeRequestCallback = void (*)(v8::Local context, v8::Local holder, int index, InternalFieldInfo* info); @@ -1011,10 +1011,10 @@ class Environment : public MemoryRetainer { template static inline T* GetBindingData(v8::Local context); - typedef std::unordered_map< + using BindingDataStore = std::unordered_map< FastStringKey, BaseObjectPtr, - FastStringKey::Hash> BindingDataStore; + FastStringKey::Hash>; // Create an Environment without initializing a main Context. Use // InitializeMainContext() to initialize a main context for it. @@ -1042,7 +1042,7 @@ class Environment : public MemoryRetainer { inline const std::vector& argv(); const std::string& exec_path() const; - typedef void (*HandleCleanupCb)(Environment* env, + using HandleCleanupCb = void (*)(Environment* env, uv_handle_t* handle, void* arg); struct HandleCleanup { @@ -1296,8 +1296,8 @@ class Environment : public MemoryRetainer { inline void set_is_in_inspector_console_call(bool value); #endif - typedef ListHead HandleWrapQueue; - typedef ListHead ReqWrapQueue; + using HandleWrapQueue = ListHead; + using ReqWrapQueue = ListHead; inline HandleWrapQueue* handle_wrap_queue() { return &handle_wrap_queue_; } inline ReqWrapQueue* req_wrap_queue() { return &req_wrap_queue_; } @@ -1537,7 +1537,7 @@ class Environment : public MemoryRetainer { std::list at_exit_functions_; - typedef CallbackQueue NativeImmediateQueue; + using NativeImmediateQueue = CallbackQueue; NativeImmediateQueue native_immediates_; Mutex native_immediates_threadsafe_mutex_; NativeImmediateQueue native_immediates_threadsafe_; From 822f8ba08d5b413244d974695627a08454b2cc63 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:03:25 +0530 Subject: [PATCH 11/43] src: replace typedef with using in inspector_socket.cc --- src/inspector_socket.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index cacff747d08bc3..c205485c0ad345 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -176,7 +176,7 @@ static bool IsIPAddress(const std::string& host) { // Constants for hybi-10 frame format. -typedef int OpCode; +using OpCode = int; const OpCode kOpCodeContinuation = 0x0; const OpCode kOpCodeText = 0x1; From d9070f35be97b75d85b7863ed93b2c98b3fa29fb Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:08:51 +0530 Subject: [PATCH 12/43] src: replace typedef with using in js_native_api_types.h --- src/js_native_api_types.h | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/js_native_api_types.h b/src/js_native_api_types.h index 6aba06629b3154..91f8817b90c15b 100644 --- a/src/js_native_api_types.h +++ b/src/js_native_api_types.h @@ -8,20 +8,20 @@ #include // NOLINT(modernize-deprecated-headers) #if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) - typedef uint16_t char16_t; + using char16_t = uint16_t; #endif // JSVM API types are all opaque pointers for ABI stability -// typedef undefined structs instead of void* for compile time type safety -typedef struct napi_env__* napi_env; -typedef struct napi_value__* napi_value; -typedef struct napi_ref__* napi_ref; -typedef struct napi_handle_scope__* napi_handle_scope; -typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope; -typedef struct napi_callback_info__* napi_callback_info; -typedef struct napi_deferred__* napi_deferred; - -typedef enum { +// using undefined structs instead of void* for compile time type safety +using napi_env = struct napi_env__*; +using napi_value = struct napi_value__*; +using napi_ref = struct napi_ref__*; +using napi_handle_scope = struct napi_handle_scope__*; +using napi_escapable_handle_scope = struct napi_escapable_handle_scope__*; +using napi_callback_info = struct napi_callback_info__*; +using napi_deferred = struct napi_deferred__*; + +using napi_property_attributes = enum { napi_default = 0, napi_writable = 1 << 0, napi_enumerable = 1 << 1, @@ -40,9 +40,9 @@ typedef enum { napi_enumerable | napi_configurable, #endif // NAPI_VERSION >= 8 -} napi_property_attributes; +}; -typedef enum { +using napi_valuetype = enum { // ES6 types (corresponds to typeof) napi_undefined, napi_null, @@ -54,9 +54,9 @@ typedef enum { napi_function, napi_external, napi_bigint, -} napi_valuetype; +}; -typedef enum { +using napi_typedarray_type = enum { napi_int8_array, napi_uint8_array, napi_uint8_clamped_array, @@ -68,9 +68,9 @@ typedef enum { napi_float64_array, napi_bigint64_array, napi_biguint64_array, -} napi_typedarray_type; +}; -typedef enum { +using napi_status = enum { napi_ok, napi_invalid_arg, napi_object_expected, @@ -93,7 +93,7 @@ typedef enum { napi_arraybuffer_expected, napi_detachable_arraybuffer_expected, napi_would_deadlock // unused -} napi_status; +}; // Note: when adding a new enum value to `napi_status`, please also update // * `const int last_status` in the definition of `napi_get_last_error_info()' // in file js_native_api_v8.cc. @@ -102,13 +102,13 @@ typedef enum { // * the definition of `napi_status` in doc/api/n-api.md to reflect the newly // added value(s). -typedef napi_value (*napi_callback)(napi_env env, +using napi_callback = napi_value (*)(napi_env env, napi_callback_info info); -typedef void (*napi_finalize)(napi_env env, +using napi_finalize = void (*)(napi_env env, void* finalize_data, void* finalize_hint); -typedef struct { +using napi_property_descriptor = struct { // One of utf8name or name should be NULL. const char* utf8name; napi_value name; @@ -120,41 +120,41 @@ typedef struct { napi_property_attributes attributes; void* data; -} napi_property_descriptor; +}; -typedef struct { +using napi_extended_error_info = struct { const char* error_message; void* engine_reserved; uint32_t engine_error_code; napi_status error_code; -} napi_extended_error_info; +}; #if NAPI_VERSION >= 6 -typedef enum { +using napi_key_collection_mode = enum { napi_key_include_prototypes, napi_key_own_only -} napi_key_collection_mode; +}; -typedef enum { +using napi_key_filter = enum { napi_key_all_properties = 0, napi_key_writable = 1, napi_key_enumerable = 1 << 1, napi_key_configurable = 1 << 2, napi_key_skip_strings = 1 << 3, napi_key_skip_symbols = 1 << 4 -} napi_key_filter; +}; -typedef enum { +using napi_key_conversion = enum { napi_key_keep_numbers, napi_key_numbers_to_strings -} napi_key_conversion; +}; #endif // NAPI_VERSION >= 6 #if NAPI_VERSION >= 8 -typedef struct { +using napi_type_tag = struct { uint64_t lower; uint64_t upper; -} napi_type_tag; +}; #endif // NAPI_VERSION >= 8 #endif // SRC_JS_NATIVE_API_TYPES_H_ From bf726c8fc4f159deec01b2b44f6b632807cd65fa Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:09:37 +0530 Subject: [PATCH 13/43] src: replace typedef with using in js_native_api_v8.h --- src/js_native_api_v8.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 1a62782c1ad24f..eb572fd6763416 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -16,7 +16,7 @@ class RefTracker { virtual ~RefTracker() {} virtual void Finalize(bool isEnvTeardown) {} - typedef RefTracker RefList; + using RefList = RefTracker; inline void Link(RefList* list) { prev_ = list; From aea7475626d64a6831316566866f7d802f166217 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:10:30 +0530 Subject: [PATCH 14/43] src: replace typedef with using in memory_tracker.h --- src/memory_tracker.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/memory_tracker.h b/src/memory_tracker.h index 1896624bbeb9dd..175982d9c2f114 100644 --- a/src/memory_tracker.h +++ b/src/memory_tracker.h @@ -257,8 +257,8 @@ class MemoryTracker { : isolate_(isolate), graph_(graph) {} private: - typedef std::unordered_map - NodeMap; + using NodeMap = + std::unordered_map; inline MemoryRetainerNode* CurrentNode() const; inline MemoryRetainerNode* AddNode(const MemoryRetainer* retainer, From 8a48480eb34e36b1692724a24deabbc472866ab3 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:12:09 +0530 Subject: [PATCH 15/43] src: replace typedef with using in node.cc --- src/node.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index b757013ce125cd..d4c53e0f029c0f 100644 --- a/src/node.cc +++ b/src/node.cc @@ -516,7 +516,7 @@ MaybeLocal StartExecution(Environment* env, StartExecutionCallback cb) { } #ifdef __POSIX__ -typedef void (*sigaction_cb)(int signo, siginfo_t* info, void* ucontext); +using sigaction_cb = void (*)(int signo, siginfo_t* info, void* ucontext); #endif #if NODE_USE_V8_WASM_TRAP_HANDLER #if defined(_WIN32) From 9dc9b0fb6073488994637cef082e39a85be18669 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:15:12 +0530 Subject: [PATCH 16/43] src: replace typedef with using in node.d --- src/node.d | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/node.d b/src/node.d index fae2378437ead9..a3171b2a163260 100644 --- a/src/node.d +++ b/src/node.d @@ -28,26 +28,26 @@ */ #pragma D depends_on library procfs.d -typedef struct { +using node_dtrace_connection_t = struct { int32_t fd; int32_t port; uint32_t remote; uint32_t buffered; -} node_dtrace_connection_t; +}; -typedef struct { +using node_dtrace_connection64_t = struct { int32_t fd; int32_t port; uint64_t remote; uint32_t buffered; -} node_dtrace_connection64_t; +}; -typedef struct { +using node_connection_t = struct { int fd; string remoteAddress; int remotePort; int bufferSize; -} node_connection_t; +}; translator node_connection_t { fd = *(int32_t *)copyin((uintptr_t)&nc->fd, sizeof (int32_t)); @@ -68,15 +68,15 @@ translator node_connection_t { * 32-bit and 64-bit structures received from node for HTTP client request * probe. */ -typedef struct { +using node_dtrace_http_client_request_t = struct { uint32_t url; uint32_t method; -} node_dtrace_http_client_request_t; +}; -typedef struct { +using node_dtrace_http_client_request64_t = struct { uint64_t url; uint64_t method; -} node_dtrace_http_client_request64_t; +}; /* * The following structures are never used directly, but must exist to bind the @@ -90,56 +90,56 @@ typedef struct { * node_dtrace_http_server_request_t (both below), each of these three structs * must be declared with a different size. */ -typedef struct { +using node_dtrace_http_request_t = struct { uint32_t version; uint64_t dummy1; -} node_dtrace_http_request_t; +}; -typedef struct { +using node_dtrace_http_server_request_t = struct { uint32_t version; uint64_t dummy2; uint64_t dummy3; -} node_dtrace_http_server_request_t; +}; /* * Actual 32-bit and 64-bit, v0 and v1 structures received from node for the * HTTP server request probe. */ -typedef struct { +using node_dtrace_http_server_request_v0_t = struct { uint32_t url; uint32_t method; -} node_dtrace_http_server_request_v0_t; +}; -typedef struct { +using node_dtrace_http_server_request_v1_t = struct { uint32_t version; uint32_t url; uint32_t method; uint32_t forwardedFor; -} node_dtrace_http_server_request_v1_t; +}; -typedef struct { +using node_dtrace_http_server_request64_v0_t = struct { uint64_t url; uint64_t method; -} node_dtrace_http_server_request64_v0_t; +}; -typedef struct { +using node_dtrace_http_server_request64_v1_t = struct { uint32_t version; uint32_t pad; uint64_t url; uint64_t method; uint64_t forwardedFor; -} node_dtrace_http_server_request64_v1_t; +}; /* * In the end, both client and server request probes from both old and new * binaries translate their arguments to node_http_request_t, which is what the * user's D script ultimately sees. */ -typedef struct { +using node_http_request_t = struct { string url; string method; string forwardedFor; -} node_http_request_t; +}; /* * The following translators are particularly filthy for reasons of backwards From 7a6dba4cbdac4261e9b90bb609a3d4d910a379fa Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:16:21 +0530 Subject: [PATCH 17/43] src: replace typedef with using in node.h --- src/node.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/node.h b/src/node.h index 4348dfba5b2be8..f35662326f2176 100644 --- a/src/node.h +++ b/src/node.h @@ -200,7 +200,7 @@ NODE_DEPRECATED("Use MakeCallback(..., async_context)", #ifdef _WIN32 #if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; +using ssize_t = intptr_t; # define _SSIZE_T_ # define _SSIZE_T_DEFINED #endif @@ -741,12 +741,12 @@ NODE_EXTERN v8::Local WinapiErrnoException( const char* signo_string(int errorno); -typedef void (*addon_register_func)( +using addon_register_func = void (*)( v8::Local exports, v8::Local module, void* priv); -typedef void (*addon_context_register_func)( +using addon_context_register_func = void (*)( v8::Local exports, v8::Local module, v8::Local context, @@ -899,7 +899,7 @@ NODE_EXTERN void AtExit(Environment* env, void (*cb)(void* arg), void* arg); -typedef double async_id; +using async_id = double; struct async_context { ::node::async_id async_id; ::node::async_id trigger_async_id; @@ -923,7 +923,7 @@ NODE_EXTERN void RemoveEnvironmentCleanupHook(v8::Isolate* isolate, * have no effect. */ struct ACHHandle; struct NODE_EXTERN DeleteACHHandle { void operator()(ACHHandle*) const; }; -typedef std::unique_ptr AsyncCleanupHookHandle; +using AsyncCleanupHookHandle = std::unique_ptr; /* This function is not intended to be used externally, it exists to aid in * keeping ABI compatibility between Node and Electron. */ From 47b70e967ae2803a3bca26e6fb6b8ed6a2ba1245 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:16:53 +0530 Subject: [PATCH 18/43] src: replace typedef with using in node_api.cc --- src/node_api.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_api.cc b/src/node_api.cc index 8dbf48d466dfe1..1dc12889ba361a 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -53,7 +53,7 @@ struct node_napi_env__ : public napi_env__ { std::string filename; }; -typedef node_napi_env__* node_napi_env; +using node_napi_env = node_napi_env__*; namespace v8impl { From a7f5ed5c4167c4ede46aa680a99c81063f75f11c Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:17:42 +0530 Subject: [PATCH 19/43] src: replace typedef with using in node_api.h --- src/node_api.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_api.h b/src/node_api.h index 1772c67c15afb2..85d62047cf05d9 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -28,10 +28,10 @@ struct uv_loop_s; // Forward declaration. # define NAPI_NO_RETURN #endif -typedef napi_value (*napi_addon_register_func)(napi_env env, +using napi_addon_register_func = napi_value (*)(napi_env env, napi_value exports); -typedef struct napi_module { +using napi_module = struct napi_module { int nm_version; unsigned int nm_flags; const char* nm_filename; @@ -39,7 +39,7 @@ typedef struct napi_module { const char* nm_modname; void* nm_priv; void* reserved[4]; -} napi_module; +}; #define NAPI_MODULE_VERSION 1 From 749d6fbda72ce00d584e59494273a8cc9de1e3ae Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:26:15 +0530 Subject: [PATCH 20/43] src: replace typedef with using in node_api_types.h --- src/node_api_types.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/node_api_types.h b/src/node_api_types.h index 58ffc61b3a5f51..2010ea99e73cfa 100644 --- a/src/node_api_types.h +++ b/src/node_api_types.h @@ -3,47 +3,47 @@ #include "js_native_api_types.h" -typedef struct napi_callback_scope__* napi_callback_scope; -typedef struct napi_async_context__* napi_async_context; -typedef struct napi_async_work__* napi_async_work; +using napi_callback_scope = struct napi_callback_scope__*; +using napi_async_context = struct napi_async_context__*; +using napi_async_work = struct napi_async_work__*; #if NAPI_VERSION >= 4 -typedef struct napi_threadsafe_function__* napi_threadsafe_function; +using napi_threadsafe_function = struct napi_threadsafe_function__*; #endif // NAPI_VERSION >= 4 #if NAPI_VERSION >= 4 -typedef enum { +using napi_threadsafe_function_release_mode = enum { napi_tsfn_release, napi_tsfn_abort -} napi_threadsafe_function_release_mode; +}; -typedef enum { +using napi_threadsafe_function_call_mode = enum { napi_tsfn_nonblocking, napi_tsfn_blocking -} napi_threadsafe_function_call_mode; +}; #endif // NAPI_VERSION >= 4 -typedef void (*napi_async_execute_callback)(napi_env env, +using napi_async_execute_callback = void (*)(napi_env env, void* data); -typedef void (*napi_async_complete_callback)(napi_env env, +using napi_async_complete_callback = void (*)(napi_env env, napi_status status, void* data); #if NAPI_VERSION >= 4 -typedef void (*napi_threadsafe_function_call_js)(napi_env env, +using napi_threadsafe_function_call_js = void (*)(napi_env env, napi_value js_callback, void* context, void* data); #endif // NAPI_VERSION >= 4 -typedef struct { +using napi_node_version = struct { uint32_t major; uint32_t minor; uint32_t patch; const char* release; -} napi_node_version; +}; #if NAPI_VERSION >= 8 -typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle; -typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle, +using napi_async_cleanup_hook_handle = struct napi_async_cleanup_hook_handle__*; +using napi_async_cleanup_hook = void (*)(napi_async_cleanup_hook_handle handle, void* data); #endif // NAPI_VERSION >= 8 From 389913da248ec11b16ea48c727fd372c74c28da9 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:26:51 +0530 Subject: [PATCH 21/43] src: replace typedef with using in node_buffer.h --- src/node_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_buffer.h b/src/node_buffer.h index 606a6f5caa3b11..3419107104e592 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -31,7 +31,7 @@ namespace Buffer { static const size_t kMaxLength = v8::TypedArray::kMaxLength; -typedef void (*FreeCallback)(char* data, void* hint); +using FreeCallback = void (*)(char* data, void* hint); NODE_EXTERN bool HasInstance(v8::Local val); NODE_EXTERN bool HasInstance(v8::Local val); From ff8cd8e1782f3e34091e09b506bba7ace677dfd2 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:27:46 +0530 Subject: [PATCH 22/43] src: replace typedef with using in node_dtrace.h --- src/node_dtrace.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node_dtrace.h b/src/node_dtrace.h index b887542abfc9cf..edb0c034ae998c 100644 --- a/src/node_dtrace.h +++ b/src/node_dtrace.h @@ -35,17 +35,17 @@ extern "C" { * below). */ -typedef struct { +using node_dtrace_connection_t = struct { int32_t fd; int32_t port; char* remote; int32_t buffered; -} node_dtrace_connection_t; +}; -typedef struct { +using node_dtrace_http_client_request_t = struct { char* url; char* method; -} node_dtrace_http_client_request_t; +}; /* * The original version of this structure contained only a url and method, just @@ -60,7 +60,7 @@ typedef struct { * by the consumer so that future versions of the translator can simply check if * a field is present by checking it against nullptr. */ -typedef struct { +using node_dtrace_http_server_request_t = struct { union { uint32_t version; uintptr_t unused; /* for compat. with old 64-bit struct */ @@ -69,7 +69,7 @@ typedef struct { char* method; char* forwardedFor; char* _pad[8]; -} node_dtrace_http_server_request_t; +}; } // extern "C" From aed8988661ceaac991bbf5a377c4e8f520278ee7 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:28:35 +0530 Subject: [PATCH 23/43] src: replace typedef with using in node_file.cc --- src/node_file.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index b8902f6b348eca..dc9f6df21807e9 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -127,7 +127,7 @@ inline int64_t GetOffset(Local value) { // We sometimes need to convert a C++ lambda function to a raw C-style function. // This is helpful, because ReqWrap::Dispatch() does not recognize lambda // functions, and thus does not wrap them properly. -typedef void(*uv_fs_callback_t)(uv_fs_t*); +using uv_fs_callback_t = void(*)(uv_fs_t*); void FSContinuationData::MemoryInfo(MemoryTracker* tracker) const { @@ -541,7 +541,7 @@ int FileHandle::ReadStop() { return 0; } -typedef SimpleShutdownWrap> FileHandleCloseWrap; +using FileHandleCloseWrap = SimpleShutdownWrap>; ShutdownWrap* FileHandle::CreateShutdownWrap(Local object) { return new FileHandleCloseWrap(this, object); From 7f4b25278cbb89c3bca4bea7a09f0b98083d9338 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:29:07 +0530 Subject: [PATCH 24/43] src: replace typedef with using in node_file.h --- src/node_file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_file.h b/src/node_file.h index f1515a3e25d6d1..b5fd7621daa0d3 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -63,7 +63,7 @@ class FSContinuationData : public MemoryRetainer { class FSReqBase : public ReqWrap { public: - typedef MaybeStackBuffer FSReqBuffer; + using FSReqBuffer = MaybeStackBuffer; inline FSReqBase(BindingData* binding_data, v8::Local req, From 64091baea82f9729937ce659e742704efc56f1f5 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:30:18 +0530 Subject: [PATCH 25/43] src: replace typedef with using in node_http2.h --- src/node_http2.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node_http2.h b/src/node_http2.h index 4d267e647d3494..3ad9b717eb92c1 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -116,12 +116,12 @@ using Nghttp2SessionCallbacksPointer = nghttp2_session_callbacks_del>>; struct Http2HeadersTraits { - typedef nghttp2_nv nv_t; + using nv_t = nghttp2_nv; }; struct Http2RcBufferPointerTraits { - typedef nghttp2_rcbuf rcbuf_t; - typedef nghttp2_vec vector_t; + using rcbuf_t = nghttp2_rcbuf; + using vector_t = nghttp2_vec; static void inc(rcbuf_t* buf) { CHECK_NOT_NULL(buf); @@ -157,7 +157,7 @@ struct NgHttp2StreamWrite : public MemoryRetainer { SET_SELF_SIZE(NgHttp2StreamWrite) }; -typedef uint32_t(*get_setting)(nghttp2_session* session, +using get_setting = uint32_t(*)(nghttp2_session* session, nghttp2_settings_id id); class Http2Ping; @@ -257,8 +257,8 @@ class Http2StreamListener : public StreamListener { }; struct Http2HeaderTraits { - typedef Http2RcBufferPointer rcbufferpointer_t; - typedef Http2Session allocator_t; + using rcbufferpointer_t = Http2RcBufferPointer; + using allocator_t = Http2Session; // HTTP/2 does not support identifying header names by token id. // HTTP/3 will, however, so we prepare for that now. From e61f221199e3cb2e85dcfa0e0b680b5efed363a1 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:31:42 +0530 Subject: [PATCH 26/43] src: replace typedef with using in node_http_common.h --- src/node_http_common.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node_http_common.h b/src/node_http_common.h index ad9f2a864e0af9..5833c9648a1b87 100644 --- a/src/node_http_common.h +++ b/src/node_http_common.h @@ -249,7 +249,7 @@ enum http_status_codes { template class NgHeaders { public: - typedef typename T::nv_t nv_t; + using nv_t = typename T::nv_t; inline NgHeaders(Environment* env, v8::Local headers); ~NgHeaders() = default; @@ -282,8 +282,8 @@ class NgHeaders { template class NgRcBufPointer : public MemoryRetainer { public: - typedef typename T::rcbuf_t rcbuf_t; - typedef typename T::vector_t vector_t; + using rcbuf_t = typename T::rcbuf_t; + using vector_t = typename T::vector_t; NgRcBufPointer() = default; @@ -474,9 +474,9 @@ struct NgHeaderBase : public MemoryRetainer { template class NgHeader final : public NgHeaderBase { public: - typedef typename T::rcbufferpointer_t rcbufferpointer_t; - typedef typename T::rcbufferpointer_t::rcbuf_t rcbuf_t; - typedef typename T::allocator_t allocator_t; + using rcbufferpointer_t = typename T::rcbufferpointer_t; + using rcbuf_t = typename T::rcbufferpointer_t::rcbuf_t; + using allocator_t = typename T::allocator_t; inline static bool IsZeroLength(rcbuf_t* name, rcbuf_t* value); inline static bool IsZeroLength(int32_t token, rcbuf_t* name, rcbuf_t* value); From 78ab5f44e10043cdd2a5d1d681fad9c604afed14 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:32:52 +0530 Subject: [PATCH 27/43] src: replace typedef with using in node_http_parser.cc --- src/node_http_parser.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index b2160512c72839..1bc1f08d7db773 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -949,8 +949,8 @@ class Parser : public AsyncWrap, public StreamListener { } }; - typedef int (Parser::*Call)(); - typedef int (Parser::*DataCall)(const char* at, size_t length); + using Call = int (Parser::*)(); + using DataCall = int (Parser::*)(const char* at, size_t length); static const llhttp_settings_t settings; }; From ca1e29f36a79843d8cf110ae3f62d8316564a9f5 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:33:22 +0530 Subject: [PATCH 28/43] src: replace typedef with using node_i18n.cc --- src/node_i18n.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 48f95ceb68d9c1..d68b9c547815a2 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -132,7 +132,7 @@ void CopySourceBuffer(MaybeStackBuffer* dest, } } -typedef MaybeLocal (*TranscodeFunc)(Environment* env, +using TranscodeFunc = MaybeLocal (*)(Environment* env, const char* fromEncoding, const char* toEncoding, const char* source, From a98cc40244c41efe0e266e7108e1e3743e899efd Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:33:57 +0530 Subject: [PATCH 29/43] src: replace typedef with using node_internals.h --- src/node_internals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_internals.h b/src/node_internals.h index b75092d662dc97..1df0a3c3d6193d 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -335,9 +335,9 @@ static constexpr unsigned kMaxSignal = 32; bool HasSignalJSHandler(int signum); #ifdef _WIN32 -typedef SYSTEMTIME TIME_TYPE; +using TIME_TYPE = SYSTEMTIME; #else // UNIX, OSX -typedef struct tm TIME_TYPE; +using TIME_TYPE = struct tm; #endif double GetCurrentTimeInMicroseconds(); From 6dc535db3eeae62b7c858030d07d362e66e8a050 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:34:28 +0530 Subject: [PATCH 30/43] src: replace typedef with using node_messaging.h --- src/node_messaging.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_messaging.h b/src/node_messaging.h index 429a5646b8ada4..38e085c022fbb6 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -17,7 +17,7 @@ namespace worker { class MessagePortData; class MessagePort; -typedef MaybeStackBuffer, 8> TransferList; +using TransferList = MaybeStackBuffer, 8>; // Used to represent the in-flight structure of an object that is being // transferred or cloned using postMessage(). From bbcc47f61f7598304de4f7cc7c0c05f78342c436 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:34:55 +0530 Subject: [PATCH 31/43] src: replace typedef with using in node_options.h --- src/node_options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_options.h b/src/node_options.h index f20234daf7e5f8..51131fe435bbc7 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -289,7 +289,7 @@ class OptionsParser { public: virtual ~OptionsParser() = default; - typedef Options TargetType; + using TargetType = Options; struct NoOp {}; struct V8Option {}; From ab4e7b2a373c5b3ef7f13b058190958193691e1d Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:36:04 +0530 Subject: [PATCH 32/43] src: replace typedef with using in node_platform.h --- src/node_platform.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_platform.h b/src/node_platform.h index a7139ebdcc28d2..9ea07aaa618ee9 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -94,7 +94,7 @@ class PerIsolatePlatformData : void (*cb)(void*); void* data; }; - typedef std::vector ShutdownCbList; + using ShutdownCbList = std::vector; ShutdownCbList shutdown_callbacks_; // shared_ptr to self to keep this object alive during shutdown. std::shared_ptr self_reference_; @@ -107,8 +107,8 @@ class PerIsolatePlatformData : TaskQueue foreground_delayed_tasks_; // Use a custom deleter because libuv needs to close the handle first. - typedef std::unique_ptr - DelayedTaskPointer; + using DelayedTaskPointer = + std::unique_ptr; std::vector scheduled_delayed_tasks_; }; From c3898c48180e976434c2f3c33ad7fa25608564cb Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:36:32 +0530 Subject: [PATCH 33/43] src: replace typedef with using in node_process_methods.cc --- src/node_process_methods.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 5030ab872f4f16..5e061cac682bd1 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -25,7 +25,7 @@ #include #include #define umask _umask -typedef int mode_t; +using mode_t = int; #else #include #include // getrlimit, setrlimit From 9f52478339012ab9fb3bc7525494e7bd2ee261ac Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:37:39 +0530 Subject: [PATCH 34/43] src: replace typedef with using in node_provider.d --- src/node_provider.d | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/node_provider.d b/src/node_provider.d index 90be45e730fd40..e2740e32bf12e4 100644 --- a/src/node_provider.d +++ b/src/node_provider.d @@ -31,25 +31,25 @@ * one that would be resolved by that elusive El Dorado: dynamic translators. */ -typedef struct { +using node_dtrace_connection_t = struct { int dummy; -} node_dtrace_connection_t; +}; -typedef struct { +using node_connection_t = struct { int dummy; -} node_connection_t; +}; -typedef struct { +using node_dtrace_http_server_request_t = struct { int dummy; -} node_dtrace_http_server_request_t; +}; -typedef struct { +using node_dtrace_http_client_request_t = struct { int dummy; -} node_dtrace_http_client_request_t; +}; -typedef struct { +using node_http_request_t = struct { int dummy; -} node_http_request_t; +}; provider node { probe net__server__connection(node_dtrace_connection_t *c, From f419f2d0931047e708d3545c48e4c6612edf3f8b Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:43:43 +0530 Subject: [PATCH 35/43] src: replace typedef with using in node_win32_etw_provider.h --- src/node_win32_etw_provider.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_win32_etw_provider.h b/src/node_win32_etw_provider.h index 0f84a86f0ac3fc..69c65a4778343d 100644 --- a/src/node_win32_etw_provider.h +++ b/src/node_win32_etw_provider.h @@ -35,18 +35,18 @@ namespace node { # define INLINE inline #endif -typedef ULONG (NTAPI* EventRegisterFunc)( +using EventRegisterFunc = ULONG (NTAPI*)( LPCGUID ProviderId, PENABLECALLBACK EnableCallback, PVOID CallbackContext, PREGHANDLE RegHandle ); -typedef ULONG (NTAPI* EventUnregisterFunc)( +using EventUnregisterFunc = ULONG (NTAPI*)( REGHANDLE RegHandle ); -typedef ULONG (NTAPI* EventWriteFunc)( +using EventWriteFunc = ULONG (NTAPI*)( REGHANDLE RegHandle, PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount, From fa0b609b0a5fcbdf83466f6d6abb1f92d2dba36b Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:44:16 +0530 Subject: [PATCH 36/43] src: replace typedef with using in node_zlib.cc --- src/node_zlib.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 2a2466052c92a5..66847b71346e63 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -654,7 +654,7 @@ class BrotliCompressionStream : public CompressionStream { inline CompressionContext* context() { return this->CompressionStream::context(); } - typedef typename CompressionStream::AllocScope AllocScope; + using AllocScope = typename CompressionStream::AllocScope; static void New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); From 0def98ab95620705842698ffc3029a64c9a1714d Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:44:48 +0530 Subject: [PATCH 37/43] src: replace typedef with using in req_wrap.h --- src/req_wrap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/req_wrap.h b/src/req_wrap.h index 5d7fcb42d01148..4bc116dc916449 100644 --- a/src/req_wrap.h +++ b/src/req_wrap.h @@ -54,7 +54,7 @@ class ReqWrap : public AsyncWrap, public ReqWrapBase { // Adding `friend struct MakeLibuvRequestCallback` is not enough anymore // for some reason. Consider this private. public: - typedef void (*callback_t)(); + using callback_t = void (*)(); callback_t original_callback_ = nullptr; protected: From e76be669a3e2cf7d013ca3b2f95f2c9733fdadb2 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:45:26 +0530 Subject: [PATCH 38/43] src: replace typedef with using in stream_wrap.cc --- src/stream_wrap.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 78d20f912b4cdb..6dda077f3d8ec4 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -304,8 +304,8 @@ void LibuvStreamWrap::SetBlocking(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(uv_stream_set_blocking(wrap->stream(), enable)); } -typedef SimpleShutdownWrap> LibuvShutdownWrap; -typedef SimpleWriteWrap> LibuvWriteWrap; +using LibuvShutdownWrap = SimpleShutdownWrap>; +using LibuvWriteWrap = SimpleWriteWrap>; ShutdownWrap* LibuvStreamWrap::CreateShutdownWrap(Local object) { return new LibuvShutdownWrap(this, object); From 3fe9780672aa25195940a2b1ca5b9cc691fe74a2 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:47:22 +0530 Subject: [PATCH 39/43] src: replace typedef with using in string_bytes.cc --- src/string_bytes.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/string_bytes.cc b/src/string_bytes.cc index daff1424d22e5a..612597e1c3102d 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -143,10 +143,10 @@ class ExternString: public ResourceType { }; -typedef ExternString ExternOneByteString; -typedef ExternString ExternTwoByteString; +using ExternOneByteString = + ExternString; +using ExternTwoByteString = + ExternString; template <> From e13cbf221273068ffda1aefad8612edaf1bbf755 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:47:59 +0530 Subject: [PATCH 40/43] src: replace typedef with using in string_search.h --- src/string_search.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/string_search.h b/src/string_search.h index cd9ef320a81112..17d57fad8daa7b 100644 --- a/src/string_search.h +++ b/src/string_search.h @@ -88,7 +88,7 @@ class StringSearchBase { template class StringSearch : private StringSearchBase { public: - typedef stringsearch::Vector Vector; + using Vector = stringsearch::Vector; explicit StringSearch(Vector pattern) : pattern_(pattern), start_(0) { @@ -140,7 +140,7 @@ class StringSearch : private StringSearchBase { } private: - typedef size_t (StringSearch::*SearchFunction)(Vector, size_t); + using SearchFunction = size_t (StringSearch::*)(Vector, size_t); size_t SingleCharSearch(Vector subject, size_t start_index); size_t LinearSearch(Vector subject, size_t start_index); size_t InitialSearch(Vector subject, size_t start_index); From dd235333f52218c0a74f86cdc0e42e04dd4def73 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:48:26 +0530 Subject: [PATCH 41/43] src: replace typedef with using in tcp_wrap.h --- src/tcp_wrap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tcp_wrap.h b/src/tcp_wrap.h index 0099eedb4bc629..581cab8aa10810 100644 --- a/src/tcp_wrap.h +++ b/src/tcp_wrap.h @@ -60,7 +60,7 @@ class TCPWrap : public ConnectionWrap { } private: - typedef uv_tcp_t HandleType; + using HandleType = uv_tcp_t; template From 6149c9cf46ea0cbe0eca45517338ade55818e5a5 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:48:53 +0530 Subject: [PATCH 42/43] src: replace typedef with using in udp_wrap.h --- src/udp_wrap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udp_wrap.h b/src/udp_wrap.h index 75a123d8fa793e..3aa5b23abd3999 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -180,7 +180,7 @@ class UDPWrap final : public HandleWrap, SET_SELF_SIZE(UDPWrap) private: - typedef uv_udp_t HandleType; + using HandleType = uv_udp_t; template From 3da92f85a3e3f5d390c6d958b7b34cef894367cf Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 13 Apr 2021 20:49:23 +0530 Subject: [PATCH 43/43] src: replace typedef with using in util.h --- src/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.h b/src/util.h index 1f7c7580a7e036..9b74379318e98c 100644 --- a/src/util.h +++ b/src/util.h @@ -634,7 +634,7 @@ struct is_callable struct FunctionDeleter { void operator()(T* pointer) const { function(pointer); } - typedef std::unique_ptr Pointer; + using Pointer = std::unique_ptr; }; template