Skip to content

Commit 79aa49d

Browse files
ldm5180awesomekling
authored andcommitted
Libraries: Use default constructors/destructors in LibHTTP
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."
1 parent 97fcbdd commit 79aa49d

File tree

6 files changed

+10
-21
lines changed

6 files changed

+10
-21
lines changed

Userland/Libraries/LibHTTP/HttpRequest.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3+
* Copyright (c) 2022, the SerenityOS developers.
34
*
45
* SPDX-License-Identifier: BSD-2-Clause
56
*/
@@ -11,14 +12,6 @@
1112

1213
namespace HTTP {
1314

14-
HttpRequest::HttpRequest()
15-
{
16-
}
17-
18-
HttpRequest::~HttpRequest()
19-
{
20-
}
21-
2215
String HttpRequest::method_name() const
2316
{
2417
switch (m_method) {

Userland/Libraries/LibHTTP/HttpRequest.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3+
* Copyright (c) 2022, the SerenityOS developers.
34
*
45
* SPDX-License-Identifier: BSD-2-Clause
56
*/
@@ -34,8 +35,8 @@ class HttpRequest {
3435
String password;
3536
};
3637

37-
HttpRequest();
38-
~HttpRequest();
38+
HttpRequest() = default;
39+
~HttpRequest() = default;
3940

4041
String const& resource() const { return m_resource; }
4142
Vector<Header> const& headers() const { return m_headers; }

Userland/Libraries/LibHTTP/HttpResponse.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3+
* Copyright (c) 2022, the SerenityOS developers.
34
*
45
* SPDX-License-Identifier: BSD-2-Clause
56
*/
@@ -15,10 +16,6 @@ HttpResponse::HttpResponse(int code, HashMap<String, String, CaseInsensitiveStri
1516
{
1617
}
1718

18-
HttpResponse::~HttpResponse()
19-
{
20-
}
21-
2219
StringView HttpResponse::reason_phrase_for_code(int code)
2320
{
2421
VERIFY(code >= 100 && code <= 599);

Userland/Libraries/LibHTTP/HttpResponse.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3+
* Copyright (c) 2022, the SerenityOS developers.
34
*
45
* SPDX-License-Identifier: BSD-2-Clause
56
*/
@@ -14,7 +15,7 @@ namespace HTTP {
1415

1516
class HttpResponse : public Core::NetworkResponse {
1617
public:
17-
virtual ~HttpResponse() override;
18+
virtual ~HttpResponse() override = default;
1819
static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String, CaseInsensitiveStringTraits>&& headers, size_t downloaded_size)
1920
{
2021
return adopt_ref(*new HttpResponse(code, move(headers), downloaded_size));

Userland/Libraries/LibHTTP/Job.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3+
* Copyright (c) 2022, the SerenityOS developers.
34
*
45
* SPDX-License-Identifier: BSD-2-Clause
56
*/
@@ -77,10 +78,6 @@ Job::Job(HttpRequest&& request, Core::Stream::Stream& output_stream)
7778
{
7879
}
7980

80-
Job::~Job()
81-
{
82-
}
83-
8481
void Job::start(Core::Stream::Socket& socket)
8582
{
8683
VERIFY(!m_socket);

Userland/Libraries/LibHTTP/Job.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, the SerenityOS developers.
2+
* Copyright (c) 2020-2022, the SerenityOS developers.
33
*
44
* SPDX-License-Identifier: BSD-2-Clause
55
*/
@@ -21,7 +21,7 @@ class Job : public Core::NetworkJob {
2121

2222
public:
2323
explicit Job(HttpRequest&&, Core::Stream::Stream&);
24-
virtual ~Job() override;
24+
virtual ~Job() override = default;
2525

2626
virtual void start(Core::Stream::Socket&) override;
2727
virtual void shutdown(ShutdownMode) override;

0 commit comments

Comments
 (0)