Skip to content

Commit

Permalink
Taking advantage of std::make_unique()
Browse files Browse the repository at this point in the history
  • Loading branch information
veloman-yunkan committed Nov 29, 2023
1 parent 7a85c92 commit 5f27b4b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/server/response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void Response::set_kind(Kind k)

std::unique_ptr<Response> Response::build()
{
return std::unique_ptr<Response>(new Response());
return std::make_unique<Response>();
}

std::unique_ptr<Response> Response::build_304(const ETag& etag)
Expand Down Expand Up @@ -389,9 +389,7 @@ std::unique_ptr<ContentResponse> ContentResponse::build(
const std::string& content,
const std::string& mimetype)
{
return std::unique_ptr<ContentResponse>(new ContentResponse(
content,
mimetype));
return std::make_unique<ContentResponse>(content, mimetype);
}

std::unique_ptr<ContentResponse> ContentResponse::build(
Expand Down Expand Up @@ -432,10 +430,7 @@ std::unique_ptr<Response> ItemResponse::build(const RequestContext& request, con
return response;
}

return std::unique_ptr<Response>(new ItemResponse(
item,
mimetype,
byteRange));
return std::make_unique<ItemResponse>(item, mimetype, byteRange);
}

MHD_Response*
Expand Down

0 comments on commit 5f27b4b

Please sign in to comment.