From 036aa43a41f7a5051660fcf4c3b5a668e4f50577 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 10 Aug 2025 16:26:49 +0200 Subject: [PATCH] LibCore: Remove unused TCPServer constructor parameter --- Libraries/LibCore/TCPServer.cpp | 9 ++++----- Libraries/LibCore/TCPServer.h | 4 ++-- Libraries/LibCore/TCPServerWindows.cpp | 9 ++++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Libraries/LibCore/TCPServer.cpp b/Libraries/LibCore/TCPServer.cpp index 0f4d8e07046..cfedab326da 100644 --- a/Libraries/LibCore/TCPServer.cpp +++ b/Libraries/LibCore/TCPServer.cpp @@ -14,7 +14,7 @@ namespace Core { -ErrorOr> TCPServer::try_create(EventReceiver* parent) +ErrorOr> TCPServer::try_create() { #ifdef SOCK_NONBLOCK int fd = TRY(Core::System::socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)); @@ -25,12 +25,11 @@ ErrorOr> TCPServer::try_create(EventReceiver* parent) TRY(Core::System::fcntl(fd, F_SETFD, FD_CLOEXEC)); #endif - return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd, parent)); + return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd)); } -TCPServer::TCPServer(int fd, EventReceiver* parent) - : EventReceiver(parent) - , m_fd(fd) +TCPServer::TCPServer(int fd) + : m_fd(fd) { VERIFY(m_fd >= 0); } diff --git a/Libraries/LibCore/TCPServer.h b/Libraries/LibCore/TCPServer.h index 64b9a2c202f..76db65cca36 100644 --- a/Libraries/LibCore/TCPServer.h +++ b/Libraries/LibCore/TCPServer.h @@ -16,7 +16,7 @@ namespace Core { class TCPServer : public EventReceiver { C_OBJECT_ABSTRACT(TCPServer) public: - static ErrorOr> try_create(EventReceiver* parent = nullptr); + static ErrorOr> try_create(); virtual ~TCPServer() override; enum class AllowAddressReuse { @@ -36,7 +36,7 @@ public: Function on_ready_to_accept; private: - explicit TCPServer(int fd, EventReceiver* parent = nullptr); + explicit TCPServer(int fd); int m_fd { -1 }; bool m_listening { false }; diff --git a/Libraries/LibCore/TCPServerWindows.cpp b/Libraries/LibCore/TCPServerWindows.cpp index 3b983eee2c2..3ef982e83a1 100644 --- a/Libraries/LibCore/TCPServerWindows.cpp +++ b/Libraries/LibCore/TCPServerWindows.cpp @@ -15,7 +15,7 @@ namespace Core { -ErrorOr> TCPServer::try_create(EventReceiver* parent) +ErrorOr> TCPServer::try_create() { int fd = TRY(Core::System::socket(AF_INET, SOCK_STREAM, 0)); ArmedScopeGuard close_fd { [fd]() { @@ -28,12 +28,11 @@ ErrorOr> TCPServer::try_create(EventReceiver* parent) if (SetHandleInformation(to_handle(fd), HANDLE_FLAG_INHERIT, 0) == 0) return Error::from_windows_error(); close_fd.disarm(); - return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd, parent)); + return adopt_nonnull_ref_or_enomem(new (nothrow) TCPServer(fd)); } -TCPServer::TCPServer(int fd, EventReceiver* parent) - : EventReceiver(parent) - , m_fd(fd) +TCPServer::TCPServer(int fd) + : m_fd(fd) { VERIFY(m_fd >= 0); }