Sprinkle in some make_unique

This commit is contained in:
Marek Roszko 2022-02-05 21:26:36 -05:00
parent 0a5ddb8d40
commit d9c04da407
5 changed files with 8 additions and 8 deletions

View File

@ -1590,7 +1590,7 @@ void VIEW::Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const
std::shared_ptr<VIEW_OVERLAY> VIEW::MakeOverlay()
{
std::shared_ptr<VIEW_OVERLAY> overlay( new VIEW_OVERLAY );
std::shared_ptr<VIEW_OVERLAY> overlay = std::make_shared<VIEW_OVERLAY>();
Add( overlay.get() );
return overlay;

View File

@ -1538,7 +1538,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
aEagleLibrary->package[symbolName] = edevice.package.Get();
// Create KiCad symbol.
unique_ptr<LIB_SYMBOL> libSymbol( new LIB_SYMBOL( symbolName ) );
std::unique_ptr<LIB_SYMBOL> libSymbol = std::make_unique<LIB_SYMBOL>( symbolName );
// Process each gate in the deviceset for this device.
wxXmlNode* gateNode = getChildrenNodes( deviceSetChildren, "gates" );

View File

@ -494,8 +494,8 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
std::ofstream output( path.ToUTF8(), std::ios_base::binary );
std::unique_ptr<WX_PROGRESS_REPORTER> reporter(
new WX_PROGRESS_REPORTER( this, _( "Downloading package" ), 1 ) );
std::unique_ptr<WX_PROGRESS_REPORTER> reporter =
std::make_unique<WX_PROGRESS_REPORTER>( this, _( "Downloading package" ), 1 );
bool success = m_pcm->DownloadToStream( url, &output, reporter.get(), 0 );

View File

@ -362,8 +362,8 @@ const bool PLUGIN_CONTENT_MANAGER::CacheRepository( const wxString& aRepositoryI
nlohmann::json js;
PCM_REPOSITORY current_repo;
std::unique_ptr<WX_PROGRESS_REPORTER> reporter(
new WX_PROGRESS_REPORTER( m_dialog, wxT( "" ), 1 ) );
std::unique_ptr<WX_PROGRESS_REPORTER> reporter =
std::make_unique<WX_PROGRESS_REPORTER>( m_dialog, wxT( "" ), 1 );
if( !FetchRepository( url, current_repo, reporter.get() ) )
return false;

View File

@ -85,8 +85,8 @@ int AUTOPLACE_TOOL::autoplace( std::vector<FOOTPRINT*>& aFootprints, bool aPlace
std::function<int( FOOTPRINT* aFootprint )> callback = refreshCallback;
autoplacer.SetRefreshCallback( callback );
std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter(
new WX_PROGRESS_REPORTER( frame(), _( "Autoplace Components" ), 1 ) );
std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter =
std::make_unique<WX_PROGRESS_REPORTER>( frame(), _( "Autoplace Components" ), 1 );
autoplacer.SetProgressReporter( progressReporter.get() );
auto result = autoplacer.AutoplaceFootprints( aFootprints, &commit, aPlaceOffboard );