[vlc-devel] [PATCH] qt: use std::make_unique when possible

Alexandre Janniaux ajanni at videolabs.io
Sun Aug 25 20:19:32 CEST 2019


---
 modules/gui/qt/components/mediacenter/mlalbummodel.cpp        | 2 +-
 modules/gui/qt/components/mediacenter/mlalbumtrackmodel.cpp   | 2 +-
 modules/gui/qt/components/mediacenter/mlartistmodel.cpp       | 2 +-
 modules/gui/qt/components/mediacenter/mlgenremodel.cpp        | 2 +-
 modules/gui/qt/components/mediacenter/mlrecentsvideomodel.cpp | 2 +-
 modules/gui/qt/components/mediacenter/mlvideomodel.cpp        | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/components/mediacenter/mlalbummodel.cpp b/modules/gui/qt/components/mediacenter/mlalbummodel.cpp
index 4a585ac7f4..343f3d4d64 100644
--- a/modules/gui/qt/components/mediacenter/mlalbummodel.cpp
+++ b/modules/gui/qt/components/mediacenter/mlalbummodel.cpp
@@ -103,7 +103,7 @@ std::vector<std::unique_ptr<MLAlbum>> MLAlbumModel::fetch( )
         return {};
     std::vector<std::unique_ptr<MLAlbum>> res;
     for( const vlc_ml_album_t& album: ml_range_iterate<vlc_ml_album_t>( album_list ) )
-        res.emplace_back( new MLAlbum( m_ml, &album ) );
+        res.emplace_back( std::make_unique<MLAlbum>( m_ml, &album ) );
     return res;
 }

diff --git a/modules/gui/qt/components/mediacenter/mlalbumtrackmodel.cpp b/modules/gui/qt/components/mediacenter/mlalbumtrackmodel.cpp
index 788b656b0e..0780ed83b1 100644
--- a/modules/gui/qt/components/mediacenter/mlalbumtrackmodel.cpp
+++ b/modules/gui/qt/components/mediacenter/mlalbumtrackmodel.cpp
@@ -130,7 +130,7 @@ std::vector<std::unique_ptr<MLAlbumTrack>> MLAlbumTrackModel::fetch()
         return {};
     std::vector<std::unique_ptr<MLAlbumTrack>> res;
     for( const vlc_ml_media_t& media: ml_range_iterate<vlc_ml_media_t>( media_list ) )
-        res.emplace_back( std::unique_ptr<MLAlbumTrack>{ new MLAlbumTrack( m_ml, &media ) } );
+        res.emplace_back( std::make_unique<MLAlbumTrack>( m_ml, &media ) );
     return res;
 }

diff --git a/modules/gui/qt/components/mediacenter/mlartistmodel.cpp b/modules/gui/qt/components/mediacenter/mlartistmodel.cpp
index f60638c512..3994bd9197 100644
--- a/modules/gui/qt/components/mediacenter/mlartistmodel.cpp
+++ b/modules/gui/qt/components/mediacenter/mlartistmodel.cpp
@@ -86,7 +86,7 @@ std::vector<std::unique_ptr<MLArtist>> MLArtistModel::fetch()
         return {};
     std::vector<std::unique_ptr<MLArtist>> res;
     for( const vlc_ml_artist_t& artist: ml_range_iterate<vlc_ml_artist_t>( artist_list ) )
-        res.emplace_back( new MLArtist( &artist ) );
+        res.emplace_back( std::make_unique<MLArtist>( &artist ) );
     return res;
 }

diff --git a/modules/gui/qt/components/mediacenter/mlgenremodel.cpp b/modules/gui/qt/components/mediacenter/mlgenremodel.cpp
index c4a23ecbae..28ee74fbd7 100644
--- a/modules/gui/qt/components/mediacenter/mlgenremodel.cpp
+++ b/modules/gui/qt/components/mediacenter/mlgenremodel.cpp
@@ -85,7 +85,7 @@ std::vector<std::unique_ptr<MLGenre>> MLGenreModel::fetch()
         return {};
     std::vector<std::unique_ptr<MLGenre>> res;
     for( const vlc_ml_genre_t& genre: ml_range_iterate<vlc_ml_genre_t>( genre_list ) )
-        res.emplace_back( std::unique_ptr<MLGenre>{ new MLGenre( &genre ) } );
+        res.emplace_back( std::make_unique<MLGenre>( &genre ) );
     return res;
 }

diff --git a/modules/gui/qt/components/mediacenter/mlrecentsvideomodel.cpp b/modules/gui/qt/components/mediacenter/mlrecentsvideomodel.cpp
index a1dc8ede7d..a10a1e7fe5 100644
--- a/modules/gui/qt/components/mediacenter/mlrecentsvideomodel.cpp
+++ b/modules/gui/qt/components/mediacenter/mlrecentsvideomodel.cpp
@@ -108,7 +108,7 @@ std::vector<std::unique_ptr<MLVideo> > MLRecentsVideoModel::fetch()
         if( media.i_type == VLC_ML_MEDIA_TYPE_VIDEO )
         {
             m_video_count++;
-            res.emplace_back( std::unique_ptr<MLVideo>{ new MLVideo( m_ml, &media ) } );
+            res.emplace_back( std::make_unique<MLVideo>( m_ml, &media ) );
         }
     return res;
 }
diff --git a/modules/gui/qt/components/mediacenter/mlvideomodel.cpp b/modules/gui/qt/components/mediacenter/mlvideomodel.cpp
index c779a14736..5b4f605d3c 100644
--- a/modules/gui/qt/components/mediacenter/mlvideomodel.cpp
+++ b/modules/gui/qt/components/mediacenter/mlvideomodel.cpp
@@ -117,7 +117,7 @@ std::vector<std::unique_ptr<MLVideo> > MLVideoModel::fetch()
         return {};
     std::vector<std::unique_ptr<MLVideo>> res;
     for( vlc_ml_media_t &media: ml_range_iterate<vlc_ml_media_t>( media_list ) )
-        res.emplace_back( std::unique_ptr<MLVideo>{ new MLVideo(m_ml, &media) } );
+        res.emplace_back( std::make_unique<MLVideo>(m_ml, &media) );
     return res;
 }

--
2.23.0



More information about the vlc-devel mailing list