Skip to content

Commit

Permalink
Codechange: use default virtual destructors over empty destructors
Browse files Browse the repository at this point in the history
  • Loading branch information
rubidium42 committed Dec 6, 2024
1 parent 701cb2e commit ef76f0e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/gamelog_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using GrfIDMapping = std::map<uint32_t, GRFPresence>;

struct LoggedChange {
LoggedChange(GamelogChangeType type = GLCT_NONE) : ct(type) {}
virtual ~LoggedChange() {}
virtual ~LoggedChange() = default;
virtual void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) = 0;

GamelogChangeType ct;
Expand Down
2 changes: 1 addition & 1 deletion src/ini_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct IniLoadFile {
const IniGroupNameList seq_group_names; ///< list of group names that are sequences.

IniLoadFile(const IniGroupNameList &list_group_names = {}, const IniGroupNameList &seq_group_names = {});
virtual ~IniLoadFile() { }
virtual ~IniLoadFile() = default;

const IniGroup *GetGroup(std::string_view name) const;
IniGroup *GetGroup(std::string_view name);
Expand Down
10 changes: 5 additions & 5 deletions src/network/network_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
class NetworkEncryptionHandler {
public:
virtual ~NetworkEncryptionHandler() {}
virtual ~NetworkEncryptionHandler() = default;

/**
* Get the size of the MAC (Message Authentication Code) used by the underlying encryption protocol.
Expand Down Expand Up @@ -70,7 +70,7 @@ class NetworkEncryptionHandler {
*/
class NetworkAuthenticationPasswordRequest {
public:
virtual ~NetworkAuthenticationPasswordRequest() {}
virtual ~NetworkAuthenticationPasswordRequest() = default;

/**
* Reply to the request with the given password.
Expand Down Expand Up @@ -108,7 +108,7 @@ class NetworkAuthenticationPasswordRequestHandler : public NetworkAuthentication
*/
class NetworkAuthenticationPasswordProvider {
public:
virtual ~NetworkAuthenticationPasswordProvider() {}
virtual ~NetworkAuthenticationPasswordProvider() = default;

/**
* Callback to return the password where to validate against.
Expand Down Expand Up @@ -139,7 +139,7 @@ class NetworkAuthenticationDefaultPasswordProvider : public NetworkAuthenticatio
*/
class NetworkAuthenticationAuthorizedKeyHandler {
public:
virtual ~NetworkAuthenticationAuthorizedKeyHandler() {}
virtual ~NetworkAuthenticationAuthorizedKeyHandler() = default;

/**
* Check whether the key handler can be used, i.e. whether there are authorized keys to check against.
Expand Down Expand Up @@ -189,7 +189,7 @@ using NetworkAuthenticationMethodMask = uint16_t;
*/
class NetworkAuthenticationHandler {
public:
virtual ~NetworkAuthenticationHandler() {}
virtual ~NetworkAuthenticationHandler() = default;

/**
* Get the name of the handler for debug messages.
Expand Down
2 changes: 1 addition & 1 deletion src/random_access_file_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RandomAccessFile {
RandomAccessFile(const RandomAccessFile&) = delete;
void operator=(const RandomAccessFile&) = delete;

virtual ~RandomAccessFile() {}
virtual ~RandomAccessFile() = default;

const std::string &GetFilename() const;
const std::string &GetSimplifiedFilename() const;
Expand Down
8 changes: 2 additions & 6 deletions src/saveload/saveload_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ struct LoadFilter {
}

/** Make sure the writers are properly closed. */
virtual ~LoadFilter()
{
}
virtual ~LoadFilter() = default;

/**
* Read a given number of bytes from the savegame.
Expand Down Expand Up @@ -69,9 +67,7 @@ struct SaveFilter {
}

/** Make sure the writers are properly closed. */
virtual ~SaveFilter()
{
}
virtual ~SaveFilter() = default;

/**
* Write a given number of bytes into the savegame.
Expand Down
2 changes: 1 addition & 1 deletion src/script/api/script_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef bool (ScriptAsyncModeProc)();
class SimpleCountedObject {
public:
SimpleCountedObject() : ref_count(0) {}
virtual ~SimpleCountedObject() {}
virtual ~SimpleCountedObject() = default;

inline void AddRef() { ++this->ref_count; }
void Release();
Expand Down
2 changes: 1 addition & 1 deletion src/strgen/strgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct StringReader {
bool translation; ///< Are we reading a translation, implies !master. However, the base translation will have this false.

StringReader(StringData &data, const std::string &file, bool master, bool translation);
virtual ~StringReader() {}
virtual ~StringReader() = default;
void HandleString(char *str);

/**
Expand Down
5 changes: 1 addition & 4 deletions src/tilearea_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ class TileIterator {
}

public:
/** Some compilers really like this. */
virtual ~TileIterator()
{
}
virtual ~TileIterator() = default;

/**
* Get the tile we are currently at.
Expand Down

0 comments on commit ef76f0e

Please sign in to comment.