Skip to content

Commit 4164fa3

Browse files
authored
Converting typedef aliases to using aliases (#9589)
using aliases are pretty universally preferred over typedefs. Modern editors complain about them which is distracting. This is a pass through all typedefs, changing the non-c uses of them to using aliases.
1 parent 7651796 commit 4164fa3

File tree

136 files changed

+450
-453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+450
-453
lines changed

example/plugins/cpp-api/websocket/WSBuffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum ws_frametype {
3434
WS_FRAME_PING = 0x9,
3535
WS_FRAME_PONG = 0xA
3636
};
37-
typedef enum ws_frametype WS_FRAMETYPE;
37+
using WS_FRAMETYPE = enum ws_frametype;
3838

3939
#define WS_RSV1 0x40
4040
#define WS_RSV2 0x20

include/records/I_RecCore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int RecSetDiags(Diags *diags);
4040
//-------------------------------------------------------------------------
4141
// Config File Parsing
4242
//-------------------------------------------------------------------------
43-
typedef void (*RecConfigEntryCallback)(RecT rec_type, RecDataT data_type, const char *name, const char *value, RecSourceT source);
43+
using RecConfigEntryCallback = void (*)(RecT, RecDataT, const char *, const char *, RecSourceT);
4444

4545
void RecConfigFileInit();
4646
int RecConfigFileParse(const char *path, RecConfigEntryCallback handler);
@@ -154,7 +154,7 @@ RecErrT RecGetRecordBool(const char *name, RecBool *rec_byte, bool lock = true);
154154
//------------------------------------------------------------------------
155155
// Record Attributes Reading
156156
//------------------------------------------------------------------------
157-
typedef void (*RecLookupCallback)(const RecRecord *, void *);
157+
using RecLookupCallback = void (*)(const RecRecord *, void *);
158158

159159
RecErrT RecLookupRecord(const char *name, RecLookupCallback callback, void *data, bool lock = true);
160160
RecErrT RecLookupMatchingRecords(unsigned rec_type, const char *match, RecLookupCallback callback, void *data, bool lock = true);

include/records/I_RecDefs.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ enum RecErrT {
4040
//-------------------------------------------------------------------------
4141
#define RecStringNull nullptr
4242

43-
typedef int64_t RecInt;
44-
typedef float RecFloat;
45-
typedef char *RecString;
46-
typedef const char *RecStringConst;
47-
typedef int64_t RecCounter;
48-
typedef int8_t RecByte;
49-
typedef bool RecBool;
43+
using RecInt = int64_t;
44+
using RecFloat = float;
45+
using RecString = char *;
46+
using RecStringConst = const char *;
47+
using RecCounter = int64_t;
48+
using RecByte = int8_t;
49+
using RecBool = bool;
5050

5151
enum RecT {
5252
RECT_NULL = 0x00,
@@ -178,6 +178,6 @@ struct RecRawStatBlock {
178178
//-------------------------------------------------------------------------
179179
// RecCore Callback Types
180180
//-------------------------------------------------------------------------
181-
typedef int (*RecConfigUpdateCb)(const char *name, RecDataT data_type, RecData data, void *cookie);
182-
typedef int (*RecStatUpdateFunc)(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id, void *cookie);
183-
typedef int (*RecRawStatSyncCb)(const char *name, RecDataT data_type, RecData *data, RecRawStatBlock *rsb, int id);
181+
using RecConfigUpdateCb = int (*)(const char *, RecDataT, RecData, void *);
182+
using RecStatUpdateFunc = int (*)(const char *, RecDataT, RecData *, RecRawStatBlock *, int, void *);
183+
using RecRawStatSyncCb = int (*)(const char *, RecDataT, RecData *, RecRawStatBlock *, int);

include/records/I_RecHttp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ extern SessionProtocolNameRegistry globalSessionProtocolNameRegistry;
243243
*/
244244
struct HttpProxyPort {
245245
private:
246-
typedef HttpProxyPort self; ///< Self reference type.
246+
using self = HttpProxyPort; ///< Self reference type.
247247
public:
248248
/// Explicitly supported collection of proxy ports.
249-
typedef std::vector<self> Group;
249+
using Group = std::vector<self>;
250250

251251
/// Type of transport on the connection.
252252
enum TransportType {

include/records/I_RecordsConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct RecordElement {
4646
RecAccessT access; // access level of the record
4747
};
4848

49-
typedef void (*RecordElementCallback)(const RecordElement *, void *);
49+
using RecordElementCallback = void (*)(const RecordElement *, void *);
5050
void RecordsConfigIterate(RecordElementCallback, void *);
5151

5252
void LibRecordsConfigInit(); // initializes RecordsConfigIndex

include/records/P_RecDefs.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ enum RecEntryT {
5858
RECE_RECORD,
5959
};
6060

61-
typedef struct RecConfigCbList_t {
61+
using RecConfigUpdateCbList = struct RecConfigCbList_t {
6262
RecConfigUpdateCb update_cb;
6363
void *update_cookie;
6464
struct RecConfigCbList_t *next;
65-
} RecConfigUpdateCbList;
65+
};
6666

67-
typedef struct RecStatUpdateFuncList_t {
67+
using RecStatUpdateFuncList = struct RecStatUpdateFuncList_t {
6868
RecRawStatBlock *rsb;
6969
int id;
7070
RecStatUpdateFunc update_func;
7171
void *update_cookie;
7272
struct RecStatUpdateFuncList_t *next;
73-
} RecStatUpdateFuncList;
73+
};
7474

7575
struct RecStatMeta {
7676
RecRawStat data_raw;
@@ -142,8 +142,8 @@ struct RecMessageItr {
142142
int next;
143143
};
144144

145-
typedef RecMessageHdr RecMessage;
145+
using RecMessage = RecMessageHdr;
146146

147-
typedef void (*RecDumpEntryCb)(RecT rec_type, void *edata, int registered, const char *name, int data_type, RecData *datum);
147+
using RecDumpEntryCb = void (*)(RecT, void *, int, const char *, int, RecData *);
148148

149-
typedef RecErrT (*RecMessageRecvCb)(RecMessage *msg, RecMessageT msg_type, void *cookie);
149+
using RecMessageRecvCb = RecErrT (*)(RecMessage *, RecMessageT, void *);

include/records/P_RecFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
//-------------------------------------------------------------------------
2929

3030
#define REC_HANDLE_INVALID -1
31-
typedef int RecHandle;
31+
using RecHandle = int;
3232

3333
static constexpr unsigned VERSION_HDR_SIZE = 5;
3434
//-------------------------------------------------------------------------

include/tscore/ConsistentHash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct ATSConsistentHashNode {
3838

3939
std::ostream &operator<<(std::ostream &os, ATSConsistentHashNode &thing);
4040

41-
typedef std::map<uint64_t, ATSConsistentHashNode *>::iterator ATSConsistentHashIter;
41+
using ATSConsistentHashIter = std::map<uint64_t, ATSConsistentHashNode *>::iterator;
4242

4343
/*
4444
TSConsistentHash requires a TSHash64 object

include/tscore/DiagsTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enum DiagsShowLocation { SHOW_LOCATION_NONE = 0, SHOW_LOCATION_DEBUG, SHOW_LOCAT
7373

7474
// Cleanup Function Prototype - Called before ink_fatal to
7575
// cleanup process state
76-
typedef void (*DiagsCleanupFunc)();
76+
using DiagsCleanupFunc = void (*)();
7777

7878
class DiagsConfigState
7979
{

include/tscore/Errata.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,32 +85,32 @@ class Errata
8585
/// Implementation class.
8686
struct Data;
8787
/// Handle for implementation class instance.
88-
typedef IntrusivePtr<Data> ImpPtr;
88+
using ImpPtr = IntrusivePtr<Data>;
8989

9090
public:
91-
typedef Errata self; /// Self reference type.
91+
using self = Errata; /// Self reference type.
9292

9393
/// Message ID.
94-
typedef NumericType<unsigned int, struct MsgIdTag> Id;
94+
using Id = NumericType<unsigned int, struct MsgIdTag>;
9595

9696
/* Tag / level / code severity.
9797
This is intended for clients to use to provide additional
9898
classification of a message. A severity code, as for syslog,
9999
is a common use.
100100
101101
*/
102-
typedef NumericType<unsigned int, struct CodeTag> Code;
102+
using Code = NumericType<unsigned int, struct CodeTag>;
103103
struct Message;
104104

105-
typedef std::deque<Message> Container; ///< Storage type for messages.
105+
using Container = std::deque<Message>; ///< Storage type for messages.
106106
// We iterate backwards to look like a stack.
107-
// typedef Container::reverse_iterator iterator; ///< Message iteration.
107+
// using iterator = Container::reverse_iterator; ///< Message iteration.
108108
/// Message const iteration.
109-
// typedef Container::const_reverse_iterator const_iterator;
109+
// using const_iterator = Container::const_reverse_iterator;
110110
/// Reverse message iteration.
111-
// typedef Container::iterator reverse_iterator;
111+
// using reverse_iterator = Container::iterator;
112112
/// Reverse constant message iteration.
113-
// typedef Container::const_iterator const_reverse_iterator;
113+
// using const_reverse_iterator = Container::const_iterator;
114114

115115
/// Default constructor - empty errata, very fast.
116116
Errata();
@@ -288,8 +288,8 @@ class Errata
288288
class Sink : public IntrusivePtrCounter
289289
{
290290
public:
291-
typedef Sink self; ///< Self reference type.
292-
typedef IntrusivePtr<self> Handle; ///< Handle type.
291+
using self = Sink; ///< Self reference type.
292+
using Handle = IntrusivePtr<self>; ///< Handle type.
293293

294294
/// Handle an abandoned errata.
295295
virtual void operator()(Errata const &) const = 0;
@@ -301,7 +301,7 @@ class Errata
301301
static void registerSink(Sink::Handle const &s);
302302

303303
/// Register a function as a sink.
304-
typedef void (*SinkHandlerFunction)(Errata const &);
304+
using SinkHandlerFunction = void (*)(Errata const &);
305305

306306
// Wrapper class to support registering functions as sinks.
307307
struct SinkFunctionWrapper : public Sink {
@@ -374,7 +374,7 @@ extern std::ostream &operator<<(std::ostream &os, Errata const &stat);
374374

375375
/// Storage for a single message.
376376
struct Errata::Message {
377-
typedef Message self; ///< Self reference type.
377+
using self = Message; ///< Self reference type.
378378

379379
/// Default constructor.
380380
/// The message has Id = 0, default code, and empty text.
@@ -447,7 +447,7 @@ struct Errata::Message {
447447
static Code Default_Code;
448448

449449
/// Type for overriding success message test.
450-
typedef bool (*SuccessTest)(Message const &m);
450+
using SuccessTest = bool (*)(Message const &m);
451451

452452
/** Success message test.
453453
@@ -488,7 +488,7 @@ struct Errata::Message {
488488
mainly because the client can't see this class so we can't
489489
*/
490490
struct Errata::Data : public IntrusivePtrCounter {
491-
typedef Data self; ///< Self reference type.
491+
using self = Data; ///< Self reference type.
492492

493493
//! Default constructor.
494494
Data();
@@ -517,8 +517,8 @@ struct Errata::Data : public IntrusivePtrCounter {
517517
class Errata::iterator : public Errata::Container::reverse_iterator
518518
{
519519
public:
520-
typedef iterator self; ///< Self reference type.
521-
typedef Errata::Container::reverse_iterator super; ///< Parent type.
520+
using self = iterator; ///< Self reference type.
521+
using super = Errata::Container::reverse_iterator; ///< Parent type.
522522
iterator(); ///< Default constructor.
523523
/// Copy constructor.
524524
iterator(self const &that ///< Source instance.
@@ -540,8 +540,8 @@ class Errata::iterator : public Errata::Container::reverse_iterator
540540
class Errata::const_iterator : public Errata::Container::const_reverse_iterator
541541
{
542542
public:
543-
typedef const_iterator self; ///< Self reference type.
544-
typedef Errata::Container::const_reverse_iterator super; ///< Parent type.
543+
using self = const_iterator; ///< Self reference type.
544+
using super = Errata::Container::const_reverse_iterator; ///< Parent type.
545545
const_iterator(); ///< Default constructor.
546546
/// Copy constructor.
547547
const_iterator(self const &that ///< Source instance.
@@ -601,9 +601,9 @@ struct RvBase {
601601
asynchronously.
602602
*/
603603
template <typename R> struct Rv : public RvBase {
604-
typedef Rv self; ///< Standard self reference type.
605-
typedef RvBase super; ///< Standard super class reference type.
606-
typedef R Result; ///< Type of result value.
604+
using self = Rv; ///< Standard self reference type.
605+
using super = RvBase; ///< Standard super class reference type.
606+
using Result = R; ///< Type of result value.
607607

608608
Result _result; ///< The actual result of the function.
609609

0 commit comments

Comments
 (0)