Skip to content

Commit

Permalink
Services: Use default constructors/destructors
Browse files Browse the repository at this point in the history
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
  • Loading branch information
ldm5180 authored and bgianfo committed Mar 25, 2022
1 parent 5550905 commit 0b7baa7
Show file tree
Hide file tree
Showing 80 changed files with 50 additions and 202 deletions.
4 changes: 0 additions & 4 deletions Userland/Services/AudioServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(client_id, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/AudioServer/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Mixer;
class ConnectionFromClient final : public IPC::ConnectionFromClient<AudioClientEndpoint, AudioServerEndpoint> {
C_OBJECT(ConnectionFromClient)
public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

void did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id);
void did_change_client_volume(Badge<ClientAudioStream>, double volume);
Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/AudioServer/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ Mixer::Mixer(NonnullRefPtr<Core::ConfigFile> config)
m_sound_thread->start();
}

Mixer::~Mixer()
{
}

NonnullRefPtr<ClientAudioStream> Mixer::create_queue(ConnectionFromClient& client)
{
auto queue = adopt_ref(*new ClientAudioStream(client));
Expand Down
4 changes: 2 additions & 2 deletions Userland/Services/AudioServer/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ConnectionFromClient;
class ClientAudioStream : public RefCounted<ClientAudioStream> {
public:
explicit ClientAudioStream(ConnectionFromClient&);
~ClientAudioStream() { }
~ClientAudioStream() = default;

bool is_full() const { return m_queue.size() >= 3; }
void enqueue(NonnullRefPtr<Audio::Buffer>&&);
Expand Down Expand Up @@ -112,7 +112,7 @@ class ClientAudioStream : public RefCounted<ClientAudioStream> {
class Mixer : public Core::Object {
C_OBJECT(Mixer)
public:
virtual ~Mixer() override;
virtual ~Mixer() override = default;

NonnullRefPtr<ClientAudioStream> create_queue(ConnectionFromClient&);

Expand Down
4 changes: 2 additions & 2 deletions Userland/Services/ChessEngine/ChessEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
class ChessEngine : public Chess::UCI::Endpoint {
C_OBJECT(ChessEngine)
public:
virtual ~ChessEngine() override { }
virtual ~ChessEngine() override = default;

virtual void handle_uci() override;
virtual void handle_position(const Chess::UCI::PositionCommand&) override;
virtual void handle_go(const Chess::UCI::GoCommand&) override;

private:
ChessEngine() { }
ChessEngine() = default;
ChessEngine(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevice> out)
: Endpoint(in, out)
{
Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/Clipboard/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(client_id, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/Clipboard/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ConnectionFromClient final
C_OBJECT(ConnectionFromClient);

public:
virtual ~ConnectionFromClient() override;
virtual ~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
8 changes: 0 additions & 8 deletions Userland/Services/Clipboard/Storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ Storage& Storage::the()
return s_the;
}

Storage::Storage()
{
}

Storage::~Storage()
{
}

void Storage::set_data(Core::AnonymousBuffer data, const String& mime_type, const HashMap<String, String>& metadata)
{
m_buffer = move(data);
Expand Down
4 changes: 2 additions & 2 deletions Userland/Services/Clipboard/Storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Clipboard {
class Storage {
public:
static Storage& the();
~Storage();
~Storage() = default;

bool has_data() const { return m_buffer.is_valid(); }

Expand Down Expand Up @@ -44,7 +44,7 @@ class Storage {
const Core::AnonymousBuffer& buffer() const { return m_buffer; }

private:
Storage();
Storage() = default;

String m_mime_type;
Core::AnonymousBuffer m_buffer;
Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/ConfigServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(client_id, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/ConfigServer/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ConfigServer {
class ConnectionFromClient final : public IPC::ConnectionFromClient<ConfigClientEndpoint, ConfigServerEndpoint> {
C_OBJECT(ConnectionFromClient)
public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/DHCPClient/DHCPv4Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ ErrorOr<DHCPv4Client::Interfaces> DHCPv4Client::get_discoverable_interfaces()
};
}

DHCPv4Client::~DHCPv4Client()
{
}

void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options)
{
dbgln("We were offered {} for {}", packet.yiaddr().to_string(), options.get<u32>(DHCPOption::IPAddressLeaseTime).value_or(0));
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/DHCPClient/DHCPv4Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DHCPv4Client final : public Core::Object {
C_OBJECT(DHCPv4Client)

public:
virtual ~DHCPv4Client() override;
virtual ~DHCPv4Client() override = default;

void dhcp_discover(const InterfaceDescriptor& ifname);
void dhcp_request(DHCPv4Transaction& transaction, const DHCPv4Packet& packet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(1, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ConnectionFromClient final
C_OBJECT(ConnectionFromClient);

public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/ImageDecoder/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
{
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
Core::EventLoop::current().quit(0);
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/ImageDecoder/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ConnectionFromClient final
C_OBJECT(ConnectionFromClient);

public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/InspectorServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(client_id, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/InspectorServer/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ConnectionFromClient final
C_OBJECT(ConnectionFromClient);

public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/InspectorServer/InspectableProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ InspectableProcess::InspectableProcess(pid_t pid, NonnullOwnPtr<Core::Stream::Lo
};
}

InspectableProcess::~InspectableProcess()
{
}

String InspectableProcess::wait_for_response()
{
if (m_socket->is_eof()) {
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/InspectorServer/InspectableProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace InspectorServer {
class InspectableProcess {
public:
InspectableProcess(pid_t, NonnullOwnPtr<Core::Stream::LocalSocket>);
~InspectableProcess();
~InspectableProcess() = default;

void send_request(JsonObject const& request);
String wait_for_response();
Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/LaunchServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(client_id, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/LaunchServer/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace LaunchServer {
class ConnectionFromClient final : public IPC::ConnectionFromClient<LaunchClientEndpoint, LaunchServerEndpoint> {
C_OBJECT(ConnectionFromClient)
public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/LoginServer/LoginWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LoginWindow final : public GUI::Window {
C_OBJECT(LoginWindow);

public:
virtual ~LoginWindow() override { }
virtual ~LoginWindow() override = default;

Function<void()> on_submit;

Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/LookupServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(client_id, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/LookupServer/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ConnectionFromClient final
C_OBJECT(ConnectionFromClient);

public:
virtual ~ConnectionFromClient() override;
virtual ~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/LookupServer/DNSPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ByteBuffer DNSPacket::to_byte_buffer() const

class [[gnu::packed]] DNSRecordWithoutName {
public:
DNSRecordWithoutName() { }
DNSRecordWithoutName() = default;

u16 type() const { return m_type; }
u16 record_class() const { return m_class; }
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/LookupServer/DNSPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum class ShouldRandomizeCase {

class DNSPacket {
public:
DNSPacket() { }
DNSPacket() = default;

static Optional<DNSPacket> from_raw_packet(const u8*, size_t);
ByteBuffer to_byte_buffer() const;
Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/NotificationServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(client_id, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace NotificationServer {
class ConnectionFromClient final : public IPC::ConnectionFromClient<NotificationClientEndpoint, NotificationServerEndpoint> {
C_OBJECT(ConnectionFromClient)
public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/NotificationServer/NotificationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ NotificationWindow::NotificationWindow(i32 client_id, const String& text, const
};
}

NotificationWindow::~NotificationWindow()
{
}

RefPtr<NotificationWindow> NotificationWindow::get_window_by_id(i32 id)
{
auto window = s_windows.get(id);
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/NotificationServer/NotificationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NotificationWindow final : public GUI::Window {
C_OBJECT(NotificationWindow);

public:
virtual ~NotificationWindow() override;
virtual ~NotificationWindow() override = default;
void set_original_rect(Gfx::IntRect original_rect) { m_original_rect = original_rect; };

void set_text(const String&);
Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/RequestServer/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
s_connections.set(1, *this);
}

ConnectionFromClient::~ConnectionFromClient()
{
}

void ConnectionFromClient::die()
{
s_connections.remove(client_id());
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/RequestServer/ConnectionFromClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ConnectionFromClient final
C_OBJECT(ConnectionFromClient);

public:
~ConnectionFromClient() override;
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/RequestServer/GeminiProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ GeminiProtocol::GeminiProtocol()
{
}

GeminiProtocol::~GeminiProtocol()
{
}

OwnPtr<Request> GeminiProtocol::start_request(ConnectionFromClient& client, const String&, const URL& url, const HashMap<String, String>&, ReadonlyBytes)
{
Gemini::GeminiRequest request;
Expand Down
2 changes: 1 addition & 1 deletion Userland/Services/RequestServer/GeminiProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace RequestServer {
class GeminiProtocol final : public Protocol {
public:
GeminiProtocol();
virtual ~GeminiProtocol() override;
virtual ~GeminiProtocol() override = default;

virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>&, ReadonlyBytes body) override;
};
Expand Down
4 changes: 0 additions & 4 deletions Userland/Services/RequestServer/Request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ Request::Request(ConnectionFromClient& client, NonnullOwnPtr<Core::Stream::File>
{
}

Request::~Request()
{
}

void Request::stop()
{
m_client.did_finish_request({}, *this, false);
Expand Down
Loading

0 comments on commit 0b7baa7

Please sign in to comment.