summaryrefslogtreecommitdiff
path: root/src/RequestGroupEntry.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-23 21:55:52 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-23 21:55:52 +0900
commitfa9f3fb5a3c8912a0a6880ffba9c72f4424ea044 (patch)
treedeb0b47b085a3a689bf386409734bfd3f72f57d2 /src/RequestGroupEntry.cc
parentbb5b7eeedb3ce7396007818cbab4f5f5660997a5 (diff)
Wrap Command object in std::unique_ptr
Diffstat (limited to 'src/RequestGroupEntry.cc')
-rw-r--r--src/RequestGroupEntry.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/RequestGroupEntry.cc b/src/RequestGroupEntry.cc
index c5aef0bf..8241e52a 100644
--- a/src/RequestGroupEntry.cc
+++ b/src/RequestGroupEntry.cc
@@ -40,9 +40,9 @@
namespace aria2 {
RequestGroupEntry::RequestGroupEntry(RequestGroup* requestGroup,
- Command* nextCommand):
+ std::unique_ptr<Command> nextCommand):
requestGroup_(requestGroup),
- nextCommand_(nextCommand)
+ nextCommand_(std::move(nextCommand))
{
requestGroup_->increaseNumCommand();
}
@@ -50,20 +50,16 @@ RequestGroupEntry::RequestGroupEntry(RequestGroup* requestGroup,
RequestGroupEntry::~RequestGroupEntry()
{
requestGroup_->decreaseNumCommand();
- delete nextCommand_;
}
-Command* RequestGroupEntry::popNextCommand()
+std::unique_ptr<Command> RequestGroupEntry::popNextCommand()
{
- Command* temp = nextCommand_;
- nextCommand_ = 0;
- return temp;
+ return std::move(nextCommand_);
}
-void RequestGroupEntry::pushNextCommand(Command* nextCommand)
+void RequestGroupEntry::pushNextCommand(std::unique_ptr<Command> nextCommand)
{
- delete nextCommand_;
- nextCommand_ = nextCommand;
+ nextCommand_ = std::move(nextCommand);
}
} // namespace aria2