diff options
author | Sven Gothel <[email protected]> | 2020-12-14 12:42:19 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-12-14 12:42:19 +0100 |
commit | 7a5886cc138971f67de3fb4ba95227ee87ffd437 (patch) | |
tree | 1464bc2f1f731b268039368e9d5981b1d5805968 /src/direct_bt/DBTManager.cpp | |
parent | 2157c1cf56140aceade31a63b450828d766a7f51 (diff) |
smart_ptr-5: Use std::make_shared<T>(..) where possible, reducing two memory allocations to one
smart_ptr change series, commit #5
This series started with commit cafd8d1f3689135eae36854a9cca4def690045fd,
see for details.
Diffstat (limited to 'src/direct_bt/DBTManager.cpp')
-rw-r--r-- | src/direct_bt/DBTManager.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp index e98b55d6..43e4a5b9 100644 --- a/src/direct_bt/DBTManager.cpp +++ b/src/direct_bt/DBTManager.cpp @@ -981,8 +981,7 @@ bool DBTManager::addDeviceToWhitelist(const uint16_t dev_id, const BDAddressAndT if( nullptr != res && res->getOpcode() == MgmtEvent::Opcode::CMD_COMPLETE ) { const MgmtEvtCmdComplete &res1 = *static_cast<const MgmtEvtCmdComplete *>(res.get()); if( MgmtStatus::SUCCESS == res1.getStatus() ) { - std::shared_ptr<WhitelistElem> wle( new WhitelistElem{dev_id, addressAndType, ctype} ); - whitelist.push_back(wle); + whitelist.push_back( std::make_shared<WhitelistElem>(dev_id, addressAndType, ctype) ); return true; } } |