From 9d72fd0f2f18b66423b9107e30cf2792656d2eab Mon Sep 17 00:00:00 2001 From: Qingyang Chen Date: Thu, 25 Jun 2015 13:50:50 -0400 Subject: SERVER-16889.5 PlanExecutor::getStats() and PlanStage::getStats() return unique_ptr --- src/mongo/db/exec/sort.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/mongo/db/exec/sort.cpp') diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp index 7aeef7ee68b..246462f953c 100644 --- a/src/mongo/db/exec/sort.cpp +++ b/src/mongo/db/exec/sort.cpp @@ -41,13 +41,15 @@ #include "mongo/db/query/lite_parsed_query.h" #include "mongo/db/query/query_knobs.h" #include "mongo/db/query/query_planner.h" +#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { -using std::unique_ptr; using std::endl; +using std::unique_ptr; using std::vector; +using stdx::make_unique; // static const char* SortStage::kStageType = "SORT"; @@ -455,7 +457,7 @@ vector SortStage::getChildren() const { return children; } -PlanStageStats* SortStage::getStats() { +unique_ptr SortStage::getStats() { _commonStats.isEOF = isEOF(); const size_t maxBytes = static_cast(internalQueryExecMaxBlockingSortBytes); _specificStats.memLimit = maxBytes; @@ -463,10 +465,10 @@ PlanStageStats* SortStage::getStats() { _specificStats.limit = _limit; _specificStats.sortPattern = _pattern.getOwned(); - unique_ptr ret(new PlanStageStats(_commonStats, STAGE_SORT)); - ret->specific.reset(new SortStats(_specificStats)); - ret->children.push_back(_child->getStats()); - return ret.release(); + unique_ptr ret = make_unique(_commonStats, STAGE_SORT); + ret->specific = make_unique(_specificStats); + ret->children.push_back(_child->getStats().release()); + return ret; } const CommonStats* SortStage::getCommonStats() const { -- cgit v1.2.1