summaryrefslogtreecommitdiff
path: root/src/Context.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-09-13 00:07:21 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-09-13 00:07:21 +0900
commit2807258279d8ddbef01ca1c20a87c14aa084620c (patch)
treee0baa98d1b2051898a4dbde0820ed81e6438fec4 /src/Context.cc
parentbee7a8317c602a37066a7b3391b5134f31e3a5ff (diff)
Use std::make_shared and make_unique where possible, part 1
Diffstat (limited to 'src/Context.cc')
-rw-r--r--src/Context.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Context.cc b/src/Context.cc
index 7e0b0b2b..32d6e6e1 100644
--- a/src/Context.cc
+++ b/src/Context.cc
@@ -89,8 +89,8 @@ namespace aria2 {
namespace {
void showTorrentFile(const std::string& uri)
{
- std::shared_ptr<Option> op(new Option());
- std::shared_ptr<DownloadContext> dctx(new DownloadContext());
+ auto op = std::make_shared<Option>();
+ auto dctx = std::make_shared<DownloadContext>();
bittorrent::load(uri, dctx, op);
bittorrent::print(*global::cout(), dctx);
}
@@ -154,7 +154,7 @@ Context::Context(bool standalone,
int argc, char** argv, const KeyVals& options)
{
std::vector<std::string> args;
- std::shared_ptr<Option> op(new Option());
+ auto op = std::make_shared<Option>();
error_code::Value rv;
rv = option_processing(*op.get(), standalone, args, argc, argv, options);
if(rv != error_code::FINISHED) {
@@ -290,9 +290,8 @@ Context::Context(bool standalone,
!uriListParser) {
global::cout()->printf("%s\n", MSG_NO_FILES_TO_DOWNLOAD);
} else {
- reqinfo.reset(new MultiUrlRequestInfo(std::move(requestGroups),
- op,
- uriListParser));
+ reqinfo = std::make_shared<MultiUrlRequestInfo>
+ (std::move(requestGroups), op, uriListParser);
}
}