From 64748edab19d6c9c85a855b31574686730121bc1 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 11 Oct 2021 14:51:10 -0700 Subject: [PATCH] Replace most uses of typedef with using for type aliasing --- src/Anon.h | 2 +- src/DNS_Mgr.h | 20 ++++++++++---------- src/Debug.cc | 2 +- src/Desc.cc | 2 +- src/Dict.h | 2 +- src/Hash.h | 14 +++++++------- src/Notifier.h | 2 +- src/Obj.h | 2 +- src/PolicyFile.cc | 2 +- src/RE.cc | 2 +- src/RE.h | 2 +- src/Tag.h | 4 ++-- src/Type.cc | 3 +-- src/Type.h | 4 ++-- src/ZeekString.h | 20 ++++++++++---------- src/analyzer/Analyzer.h | 4 ++-- src/analyzer/Component.h | 2 +- src/analyzer/protocol/rpc/RPC.h | 12 ++++++------ src/file_analysis/Manager.h | 4 ++-- src/input/Component.h | 2 +- src/input/ReaderBackend.h | 2 +- src/iosource/Component.h | 6 +++--- src/iosource/Packet.h | 4 ++-- src/logging/Component.h | 2 +- src/logging/Manager.cc | 5 ++--- src/logging/WriterBackend.h | 2 +- src/net_util.h | 6 +++--- src/plugin/Manager.h | 2 +- src/plugin/Plugin.h | 6 +++--- src/probabilistic/BitVector.h | 6 +++--- src/probabilistic/CounterVector.h | 4 ++-- src/probabilistic/Hasher.h | 4 ++-- src/script_opt/CPP/RuntimeInit.h | 2 +- src/script_opt/UseDefs.h | 2 +- src/session/Session.h | 2 +- src/threading/Manager.h | 6 +++--- src/threading/SerialTypes.h | 2 +- src/util.h | 2 +- src/zeek.bif | 4 ++-- src/zeekygen/IdentifierInfo.h | 4 ++-- src/zeekygen/Manager.h | 6 +++--- src/zeekygen/ScriptInfo.cc | 2 +- src/zeekygen/ScriptInfo.h | 4 ++-- src/zeekygen/Target.h | 9 +++++---- 44 files changed, 100 insertions(+), 101 deletions(-) diff --git a/src/Anon.h b/src/Anon.h index 04adab015e..f81b03bf94 100644 --- a/src/Anon.h +++ b/src/Anon.h @@ -37,7 +37,7 @@ enum ip_addr_anonymization_method_t NUM_ADDR_ANONYMIZATION_METHODS, }; -typedef uint32_t ipaddr32_t; +using ipaddr32_t = uint32_t; // NOTE: all addresses in parameters of *public* functions are in // network order. diff --git a/src/DNS_Mgr.h b/src/DNS_Mgr.h index 6a43677cc4..ef9b61db74 100644 --- a/src/DNS_Mgr.h +++ b/src/DNS_Mgr.h @@ -124,9 +124,9 @@ protected: ListValPtr AddrListDelta(ListVal* al1, ListVal* al2); void DumpAddrList(FILE* f, ListVal* al); - typedef std::map> HostMap; - typedef std::map AddrMap; - typedef std::map TextMap; + using HostMap = std::map>; + using AddrMap = std::map; + using TextMap = std::map; void LoadCache(FILE* f); void Save(FILE* f, const AddrMap& m); void Save(FILE* f, const HostMap& m); @@ -168,7 +168,7 @@ protected: RecordTypePtr dm_rec; - typedef std::list CallbackList; + using CallbackList = std::list; struct AsyncRequest { @@ -217,16 +217,16 @@ protected: } }; - typedef std::map AsyncRequestAddrMap; + using AsyncRequestAddrMap = std::map; AsyncRequestAddrMap asyncs_addrs; - typedef std::map AsyncRequestNameMap; + using AsyncRequestNameMap = std::map; AsyncRequestNameMap asyncs_names; - typedef std::map AsyncRequestTextMap; + using AsyncRequestTextMap = std::map; AsyncRequestTextMap asyncs_texts; - typedef std::list QueuedList; + using QueuedList = std::list; QueuedList asyncs_queued; struct AsyncRequestCompare @@ -234,8 +234,8 @@ protected: bool operator()(const AsyncRequest* a, const AsyncRequest* b) { return a->time > b->time; } }; - typedef std::priority_queue, AsyncRequestCompare> - TimeoutQueue; + using TimeoutQueue = + std::priority_queue, AsyncRequestCompare>; TimeoutQueue asyncs_timeouts; unsigned long num_requests; diff --git a/src/Debug.cc b/src/Debug.cc index d29daf842b..eb08b54207 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -59,7 +59,7 @@ bool in_debug = false; // ### fix this hardwired access to external variables etc. struct yy_buffer_state; -typedef struct yy_buffer_state* YY_BUFFER_STATE; +using YY_BUFFER_STATE = struct yy_buffer_state*; YY_BUFFER_STATE bro_scan_string(const char*); extern YYLTYPE yylloc; // holds start line and column of token diff --git a/src/Desc.cc b/src/Desc.cc index 25b70a1e77..7eac71491d 100644 --- a/src/Desc.cc +++ b/src/Desc.cc @@ -267,7 +267,7 @@ size_t ODesc::StartsWithEscapeSequence(const char* start, const char* end) std::pair ODesc::FirstEscapeLoc(const char* bytes, size_t n) { - typedef std::pair escape_pos; + using escape_pos = std::pair; if ( IsBinary() ) return escape_pos(0, 0); diff --git a/src/Dict.h b/src/Dict.h index 241afa5144..635dc0efed 100644 --- a/src/Dict.h +++ b/src/Dict.h @@ -9,7 +9,7 @@ #include "zeek/Hash.h" // Type for function to be called when deleting elements. -typedef void (*dict_delete_func)(void*); +using dict_delete_func = void (*)(void*); namespace zeek { diff --git a/src/Hash.h b/src/Hash.h index 6227cc9c0b..0b58971cff 100644 --- a/src/Hash.h +++ b/src/Hash.h @@ -50,10 +50,10 @@ extern zeek::detail::BifReturnVal md5_hmac_bif(zeek::detail::Frame* frame, const namespace zeek::detail { -typedef uint64_t hash_t; -typedef uint64_t hash64_t; -typedef uint64_t hash128_t[2]; -typedef uint64_t hash256_t[4]; +using hash_t = uint64_t; +using hash64_t = uint64_t; +using hash128_t = uint64_t[2]; +using hash256_t = uint64_t[4]; class KeyedHash { @@ -219,12 +219,12 @@ private: friend BifReturnVal BifFunc::md5_hmac_bif(zeek::detail::Frame* frame, const Args*); }; -typedef enum -{ +enum HashKeyTag + { HASH_KEY_INT, HASH_KEY_DOUBLE, HASH_KEY_STRING -} HashKeyTag; + }; constexpr int NUM_HASH_KEYS = HASH_KEY_STRING + 1; diff --git a/src/Notifier.h b/src/Notifier.h index 7420035422..bc4c65085f 100644 --- a/src/Notifier.h +++ b/src/Notifier.h @@ -87,7 +87,7 @@ private: // Will be called from the object itself. void Modified(Modifiable* m); - typedef std::unordered_multimap ModifiableMap; + using ModifiableMap = std::unordered_multimap; ModifiableMap registrations; }; diff --git a/src/Obj.h b/src/Obj.h index 26a79fbb70..0926e23512 100644 --- a/src/Obj.h +++ b/src/Obj.h @@ -36,7 +36,7 @@ public: }; #define YYLTYPE zeek::detail::yyltype -typedef Location yyltype; +using yyltype = Location; YYLTYPE GetCurrentLocation(); // Used to mean "no location associated with this object". diff --git a/src/PolicyFile.cc b/src/PolicyFile.cc index 5176cf1539..3d7592f52b 100644 --- a/src/PolicyFile.cc +++ b/src/PolicyFile.cc @@ -35,7 +35,7 @@ struct PolicyFile vector lines; }; -typedef map PolicyFileMap; +using PolicyFileMap = map; static PolicyFileMap policy_files; namespace zeek::detail diff --git a/src/RE.cc b/src/RE.cc index 7e6443d40c..dbff44b0f7 100644 --- a/src/RE.cc +++ b/src/RE.cc @@ -304,7 +304,7 @@ void Specific_RE_Matcher::Dump(FILE* f) inline void RE_Match_State::AddMatches(const AcceptingSet& as, MatchPos position) { - typedef std::pair am_idx; + using am_idx = std::pair; for ( AcceptingSet::const_iterator it = as.begin(); it != as.end(); ++it ) accepted_matches.insert(am_idx(*it, position)); diff --git a/src/RE.h b/src/RE.h index 63c3c249bf..c9461685d5 100644 --- a/src/RE.h +++ b/src/RE.h @@ -12,7 +12,7 @@ #include "zeek/EquivClass.h" #include "zeek/List.h" -typedef int (*cce_func)(int); +using cce_func = int (*)(int); // This method is automatically generated by flex and shouldn't be namespaced extern int re_lex(void); diff --git a/src/Tag.h b/src/Tag.h index 086adee438..50ea167c48 100644 --- a/src/Tag.h +++ b/src/Tag.h @@ -42,12 +42,12 @@ public: /** * Type for the analyzer's main type. */ - typedef uint32_t type_t; + using type_t = uint32_t; /** * Type for the analyzer's subtype. */ - typedef uint32_t subtype_t; + using subtype_t = uint32_t; /** * Returns the tag's main type. diff --git a/src/Type.cc b/src/Type.cc index d35378922b..80a6e9c678 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -1689,8 +1689,7 @@ void EnumType::DescribeReST(ODesc* d, bool roles_only) const // Create temporary, reverse name map so that enums can be documented // in ascending order of their actual integral value instead of by name. - typedef map RevNameMap; - + using RevNameMap = std::map; RevNameMap rev; for ( NameMap::const_iterator it = names.begin(); it != names.end(); ++it ) diff --git a/src/Type.h b/src/Type.h index 0d54a1a986..e81ed9eec9 100644 --- a/src/Type.h +++ b/src/Type.h @@ -743,7 +743,7 @@ protected: class EnumType final : public Type { public: - typedef std::list> enum_name_list; + using enum_name_list = std::list>; explicit EnumType(const EnumType* e); explicit EnumType(const std::string& arg_name); @@ -792,7 +792,7 @@ protected: bool is_export, detail::Expr* deprecation = nullptr, bool from_redef = false); - typedef std::map NameMap; + using NameMap = std::map; NameMap names; // Whether any of the elements of the enum were added via redef's. diff --git a/src/ZeekString.h b/src/ZeekString.h index 8db2c26542..9c0845dd0e 100644 --- a/src/ZeekString.h +++ b/src/ZeekString.h @@ -17,7 +17,7 @@ namespace zeek // class VectorVal; -typedef u_char* byte_vec; +using byte_vec = u_char*; /** * A container type for holding blocks of byte data. This can be used for @@ -28,18 +28,18 @@ typedef u_char* byte_vec; class String { public: - typedef std::vector Vec; - typedef Vec::iterator VecIt; - typedef Vec::const_iterator VecCIt; + using Vec = std::vector; + using VecIt = Vec::iterator; + using VecCIt = Vec::const_iterator; - typedef std::vector CVec; - typedef Vec::iterator CVecIt; - typedef Vec::const_iterator CVecCIt; + using CVec = std::vector; + using CVecIt = Vec::iterator; + using CVecCIt = Vec::const_iterator; // IdxVecs are vectors of indices of characters in a string. - typedef std::vector IdxVec; - typedef IdxVec::iterator IdxVecIt; - typedef IdxVec::const_iterator IdxVecCIt; + using IdxVec = std::vector; + using IdxVecIt = IdxVec::iterator; + using IdxVecCIt = IdxVec::const_iterator; // Constructors creating internal copies of the data passed in. String(const u_char* str, int arg_n, bool add_NUL); diff --git a/src/analyzer/Analyzer.h b/src/analyzer/Analyzer.h index 988c3fc97d..26bce61413 100644 --- a/src/analyzer/Analyzer.h +++ b/src/analyzer/Analyzer.h @@ -57,8 +57,8 @@ class OutputHandler; // to the children list, it can invalidate iterators in the outer call, // causing a crash. using analyzer_list = std::list; -typedef uint32_t ID; -typedef void (Analyzer::*analyzer_timer_func)(double t); +using ID = uint32_t; +using analyzer_timer_func = void (Analyzer::*)(double_t); /** * Class to receive processed output from an anlyzer. diff --git a/src/analyzer/Component.h b/src/analyzer/Component.h index ebb2fb01c0..851238f587 100644 --- a/src/analyzer/Component.h +++ b/src/analyzer/Component.h @@ -28,7 +28,7 @@ class Analyzer; class Component : public plugin::Component, public plugin::TaggedComponent { public: - typedef Analyzer* (*factory_callback)(Connection* conn); + using factory_callback = Analyzer* (*)(Connection* conn); /** * Constructor. diff --git a/src/analyzer/protocol/rpc/RPC.h b/src/analyzer/protocol/rpc/RPC.h index 5dcb8e55be..3d48c14ced 100644 --- a/src/analyzer/protocol/rpc/RPC.h +++ b/src/analyzer/protocol/rpc/RPC.h @@ -215,23 +215,23 @@ public: ~Contents_RPC() override; protected: - typedef enum - { + enum state_t + { WAIT_FOR_MESSAGE, WAIT_FOR_MARKER, WAIT_FOR_DATA, WAIT_FOR_LAST_DATA, - } state_t; + }; - typedef enum - { + enum resync_state_t + { NEED_RESYNC, RESYNC_WAIT_FOR_MSG_START, RESYNC_WAIT_FOR_FULL_MSG, RESYNC_HAD_FULL_MSG, INSYNC, RESYNC_INIT, - } resync_state_t; + }; void Init() override; virtual bool CheckResync(int& len, const u_char*& data, bool orig); diff --git a/src/file_analysis/Manager.h b/src/file_analysis/Manager.h index 178e29ea43..38a5d40160 100644 --- a/src/file_analysis/Manager.h +++ b/src/file_analysis/Manager.h @@ -424,8 +424,8 @@ protected: static bool IsDisabled(const analyzer::Tag& tag); private: - typedef std::set TagSet; - typedef std::map MIMEMap; + using TagSet = std::set; + using MIMEMap = std::map; TagSet* LookupMIMEType(const std::string& mtype, bool add_if_not_found); diff --git a/src/input/Component.h b/src/input/Component.h index d29c6acb65..0fb89f5fc2 100644 --- a/src/input/Component.h +++ b/src/input/Component.h @@ -18,7 +18,7 @@ class ReaderBackend; class Component : public plugin::Component, public plugin::TaggedComponent { public: - typedef ReaderBackend* (*factory_callback)(ReaderFrontend* frontend); + using factory_callback = ReaderBackend* (*)(ReaderFrontend* frontend); /** * Constructor. diff --git a/src/input/ReaderBackend.h b/src/input/ReaderBackend.h index b4e6a5ad60..60bc8690da 100644 --- a/src/input/ReaderBackend.h +++ b/src/input/ReaderBackend.h @@ -76,7 +76,7 @@ public: struct ReaderInfo { // Structure takes ownership of the strings. - typedef std::map config_map; + using config_map = std::map; /** * A string left to the interpretation of the reader diff --git a/src/iosource/Component.h b/src/iosource/Component.h index 98d8b6d52b..e5f4bb18ca 100644 --- a/src/iosource/Component.h +++ b/src/iosource/Component.h @@ -20,7 +20,7 @@ class PktDumper; class Component : public plugin::Component { public: - typedef IOSource* (*factory_callback)(); + using factory_callback = IOSource* (*)(); /** * Constructor. @@ -63,7 +63,7 @@ public: BOTH ///< Live input as well as offline. }; - typedef PktSrc* (*factory_callback)(const std::string& path, bool is_live); + using factory_callback = PktSrc* (*)(const std::string& path, bool is_live); /** * Constructor. @@ -134,7 +134,7 @@ private: class PktDumperComponent : public plugin::Component { public: - typedef PktDumper* (*factory_callback)(const std::string& path, bool append); + using factory_callback = PktDumper* (*)(const std::string& path, bool append); /** * XXX diff --git a/src/iosource/Packet.h b/src/iosource/Packet.h index 5145724a08..3215810de0 100644 --- a/src/iosource/Packet.h +++ b/src/iosource/Packet.h @@ -8,9 +8,9 @@ #if defined(__OpenBSD__) #include -typedef struct bpf_timeval pkt_timeval; +using pkt_timeval = bpf_timeval; #else -typedef struct timeval pkt_timeval; +using pkt_timeval = struct timeval; #endif #include // For DLT_ constants diff --git a/src/logging/Component.h b/src/logging/Component.h index 4ece376435..286dc7c0e3 100644 --- a/src/logging/Component.h +++ b/src/logging/Component.h @@ -18,7 +18,7 @@ class WriterBackend; class Component : public plugin::Component, public plugin::TaggedComponent { public: - typedef WriterBackend* (*factory_callback)(WriterFrontend* frontend); + using factory_callback = WriterBackend* (*)(WriterFrontend* frontend); /** * Constructor. diff --git a/src/logging/Manager.cc b/src/logging/Manager.cc index a50c1d8952..3e1b161893 100644 --- a/src/logging/Manager.cc +++ b/src/logging/Manager.cc @@ -85,9 +85,8 @@ struct Manager::Stream Func* policy; list filters; - typedef pair WriterPathPair; - - typedef map WriterMap; + using WriterPathPair = pair; + using WriterMap = map; WriterMap writers; // Writers indexed by id/path pair. diff --git a/src/logging/WriterBackend.h b/src/logging/WriterBackend.h index b3397c49ca..30203d26da 100644 --- a/src/logging/WriterBackend.h +++ b/src/logging/WriterBackend.h @@ -53,7 +53,7 @@ public: struct WriterInfo { // Structure takes ownership of these strings. - typedef std::map config_map; + using config_map = std::map; /** * A string left to the interpretation of the writer diff --git a/src/net_util.h b/src/net_util.h index f3f3b70801..3a6f697388 100644 --- a/src/net_util.h +++ b/src/net_util.h @@ -15,11 +15,11 @@ enum TransportProto extern const char* transport_proto_string(TransportProto proto); -typedef enum -{ +enum IPFamily + { IPv4, IPv6 -} IPFamily; + }; #include #include diff --git a/src/plugin/Manager.h b/src/plugin/Manager.h index 0a7e208ec6..92b28d7b62 100644 --- a/src/plugin/Manager.h +++ b/src/plugin/Manager.h @@ -53,7 +53,7 @@ namespace plugin class Manager { public: - typedef void (*bif_init_func)(Plugin*); + using bif_init_func = void (*)(Plugin*); using plugin_list = std::list; using component_list = Plugin::component_list; using inactive_plugin_list = std::list>; diff --git a/src/plugin/Plugin.h b/src/plugin/Plugin.h index ac21e99645..b9dc8a6a22 100644 --- a/src/plugin/Plugin.h +++ b/src/plugin/Plugin.h @@ -574,9 +574,9 @@ using HookArgumentList = std::list; class Plugin { public: - typedef std::list component_list; - typedef std::list bif_item_list; - typedef std::list> hook_list; + using component_list = std::list; + using bif_item_list = std::list; + using hook_list = std::list>; /** * The different types of @loads supported by HookLoadFile. diff --git a/src/probabilistic/BitVector.h b/src/probabilistic/BitVector.h index 3f4c94e9e9..a18ac1412a 100644 --- a/src/probabilistic/BitVector.h +++ b/src/probabilistic/BitVector.h @@ -21,9 +21,9 @@ namespace zeek::probabilistic::detail class BitVector { public: - typedef uint64_t block_type; - typedef size_t size_type; - typedef bool const_reference; + using block_type = uint64_t; + using size_type = size_t; + using const_reference = bool; static size_type npos; static block_type bits_per_block; diff --git a/src/probabilistic/CounterVector.h b/src/probabilistic/CounterVector.h index 0f43b20582..c4a40becea 100644 --- a/src/probabilistic/CounterVector.h +++ b/src/probabilistic/CounterVector.h @@ -25,8 +25,8 @@ class BitVector; class CounterVector { public: - typedef size_t size_type; - typedef uint64_t count_type; + using size_type = size_t; + using count_type = uint64_t; /** * Constructs a counter vector having cells of a given width. diff --git a/src/probabilistic/Hasher.h b/src/probabilistic/Hasher.h index 0ae84cc0c2..70a3ca6630 100644 --- a/src/probabilistic/Hasher.h +++ b/src/probabilistic/Hasher.h @@ -29,8 +29,8 @@ enum HasherType class Hasher { public: - typedef zeek::detail::hash_t digest; - typedef std::vector digest_vector; + using digest = zeek::detail::hash_t; + using digest_vector = std::vector; struct seed_t { // actually HH_U64, which has the same type diff --git a/src/script_opt/CPP/RuntimeInit.h b/src/script_opt/CPP/RuntimeInit.h index 5a6c4fd305..fbc44a32dc 100644 --- a/src/script_opt/CPP/RuntimeInit.h +++ b/src/script_opt/CPP/RuntimeInit.h @@ -17,7 +17,7 @@ namespace detail // An initialization hook for a collection of compiled-to-C++ functions // (the result of a single invocation of the compiler on a set of scripts). -typedef void (*CPP_init_func)(); +using CPP_init_func = void (*)(); // Tracks the initialization hooks for different compilation runs. extern std::vector CPP_init_funcs; diff --git a/src/script_opt/UseDefs.h b/src/script_opt/UseDefs.h index 9f934c8e80..ac30afde46 100644 --- a/src/script_opt/UseDefs.h +++ b/src/script_opt/UseDefs.h @@ -18,7 +18,7 @@ namespace zeek::detail // across function calls). class UseDefSet; -typedef std::shared_ptr UDs; +using UDs = std::shared_ptr; class UseDefSet { diff --git a/src/session/Session.h b/src/session/Session.h index 2a01da19e8..119b17e82c 100644 --- a/src/session/Session.h +++ b/src/session/Session.h @@ -29,7 +29,7 @@ class Timer; } class Session; -typedef void (Session::*timer_func)(double t); +using timer_func = void (Session::*)(double t); class Session : public Obj { diff --git a/src/threading/Manager.h b/src/threading/Manager.h index b7e596320f..62716e88fa 100644 --- a/src/threading/Manager.h +++ b/src/threading/Manager.h @@ -65,7 +65,7 @@ public: */ bool Terminating() const { return terminating; } - typedef std::list> msg_stats_list; + using msg_stats_list = std::list>; /** * Returns statistics from all current MsgThread instances. @@ -143,10 +143,10 @@ protected: void StartHeartbeatTimer(); private: - typedef std::list all_thread_list; + using all_thread_list = std::list; all_thread_list all_threads; - typedef std::list msg_thread_list; + using msg_thread_list = std::list; msg_thread_list msg_threads; bool did_process; // True if the last Process() found some work to do. diff --git a/src/threading/SerialTypes.h b/src/threading/SerialTypes.h index 4636225d2e..95e765a6d1 100644 --- a/src/threading/SerialTypes.h +++ b/src/threading/SerialTypes.h @@ -120,7 +120,7 @@ struct Value bro_int_t size; Value** vals; }; - typedef set_t vec_t; + using vec_t = set_t; struct port_t { bro_uint_t port; diff --git a/src/util.h b/src/util.h index 039e9fdd81..fa07f585a7 100644 --- a/src/util.h +++ b/src/util.h @@ -284,7 +284,7 @@ double calc_next_rotate(double current, double rotate_interval, double base); template void delete_each(T* t) { - typedef typename T::iterator iterator; + using iterator = typename T::iterator; for ( iterator it = t->begin(); it != t->end(); ++it ) delete *it; } diff --git a/src/zeek.bif b/src/zeek.bif index 80abdb3af7..2412945eb1 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -3087,14 +3087,14 @@ function decode_base64_conn%(cid: conn_id, s: string, a: string &default=""%): s %} %%{ -typedef struct { +struct bro_uuid_t { uint32_t time_low; uint16_t time_mid; uint16_t time_hi_and_version; uint8_t clock_seq_hi_and_reserved; uint8_t clock_seq_low; uint8_t node[6]; -} bro_uuid_t; +}; %%} ## Converts a bytes representation of a UUID into its string form. For example, diff --git a/src/zeekygen/IdentifierInfo.h b/src/zeekygen/IdentifierInfo.h index 262961531f..3da761f018 100644 --- a/src/zeekygen/IdentifierInfo.h +++ b/src/zeekygen/IdentifierInfo.h @@ -187,8 +187,8 @@ private: bool from_redef; }; - typedef std::list redef_list; - typedef std::map record_field_map; + using redef_list = std::list; + using record_field_map = std::map; std::vector comments; zeek::detail::IDPtr id; diff --git a/src/zeekygen/Manager.h b/src/zeekygen/Manager.h index ed24d37e2c..54202d6b08 100644 --- a/src/zeekygen/Manager.h +++ b/src/zeekygen/Manager.h @@ -32,7 +32,7 @@ class ScriptInfo; */ template struct InfoMap { - typedef std::map map_type; + using map_type = std::map; /** * @param name Name of an info object to retrieve. @@ -216,8 +216,8 @@ public: bool IsUpToDate(const std::string& target_file, const std::vector& dependencies) const; private: - typedef std::vector comment_buffer_t; - typedef std::map comment_buffer_map_t; + using comment_buffer_t = std::vector; + using comment_buffer_map_t = std::map; IdentifierInfo* CreateIdentifierInfo(zeek::detail::IDPtr id, ScriptInfo* script, bool from_redef = false); diff --git a/src/zeekygen/ScriptInfo.cc b/src/zeekygen/ScriptInfo.cc index 5c7c3cb220..61e2316cf3 100644 --- a/src/zeekygen/ScriptInfo.cc +++ b/src/zeekygen/ScriptInfo.cc @@ -107,7 +107,7 @@ static string make_redef_summary(const string& heading, char underline, char bor d.SetQuotes(true); id->DescribeReSTShort(&d); - typedef list redef_list; + using redef_list = std::list; redef_list redefs = (*it)->GetRedefs(from_script); for ( redef_list::const_iterator iit = redefs.begin(); iit != redefs.end(); ++iit ) diff --git a/src/zeekygen/ScriptInfo.h b/src/zeekygen/ScriptInfo.h index 1042c51239..6ad92fcb95 100644 --- a/src/zeekygen/ScriptInfo.h +++ b/src/zeekygen/ScriptInfo.h @@ -85,8 +85,8 @@ public: std::vector GetComments() const; private: - typedef std::map id_info_map; - typedef std::set string_set; + using id_info_map = std::map; + using string_set = std::set; time_t DoGetModificationTime() const override; diff --git a/src/zeekygen/Target.h b/src/zeekygen/Target.h index 1008cc4fe2..cbd71b518a 100644 --- a/src/zeekygen/Target.h +++ b/src/zeekygen/Target.h @@ -149,8 +149,8 @@ public: } private: - typedef Target* (*TargetFactoryFn)(const std::string& name, const std::string& pattern); - typedef std::map target_creator_map; + using TargetFactoryFn = Target* (*)(const std::string& name, const std::string& pattern); + using target_creator_map = std::map; target_creator_map target_creators; }; @@ -167,7 +167,7 @@ public: void CreateAnalyzerDoc(FILE* f) const { return DoCreateAnalyzerDoc(f); } protected: - typedef void (*doc_creator_fn)(FILE*); + using doc_creator_fn = void (*)(FILE*); AnalyzerTarget(const std::string& name, const std::string& pattern) : Target(name, pattern) { } @@ -262,7 +262,8 @@ private: std::vector pkg_deps; std::vector script_deps; - typedef std::map> manifest_t; + + using manifest_t = std::map>; manifest_t pkg_manifest; };