Return and use constant reference from Partition::get_mountpoints() (!94)

Closes !94 - Make more getter methods use return-by-constant-reference
This commit is contained in:
Mike Fleetwood 2021-10-31 17:15:10 +00:00 committed by Curtis Gedak
parent b3f1c22860
commit a8e8e9fd97
4 changed files with 6 additions and 5 deletions

View file

@ -115,7 +115,7 @@ public:
void add_mountpoints( const std::vector<Glib::ustring> & mountpoints );
const Glib::ustring& get_mountpoint() const;
void clear_mountpoints() ;
std::vector<Glib::ustring> get_mountpoints() const ;
const std::vector<Glib::ustring>& get_mountpoints() const;
Sector get_sector() const ;
bool test_overlap( const Partition & partition ) const ;
bool filesystem_label_known() const;

View file

@ -374,7 +374,8 @@ const Glib::ustring& Partition::get_mountpoint() const
return unknown_mountpoint;
}
std::vector<Glib::ustring> Partition::get_mountpoints() const
const std::vector<Glib::ustring>& Partition::get_mountpoints() const
{
return mountpoints ;
}

View file

@ -191,7 +191,7 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow,
treerow[treeview_detail_columns.fsname] = partition.get_filesystem_string();
// mount point
std::vector<Glib::ustring> temp_mountpoints = filesystem_ptn.get_mountpoints();
const std::vector<Glib::ustring>& temp_mountpoints = filesystem_ptn.get_mountpoints();
treerow[treeview_detail_columns.mountpoint] = Glib::build_path( ", ", temp_mountpoints );
if ( ! temp_mountpoints.empty() )
show_mountpoints = true;

View file

@ -1467,7 +1467,7 @@ void Win_GParted::set_valid_operations()
partitionmenu_items[MENU_MOUNT]->unset_submenu();
Gtk::Menu *menu = manage(new Gtk::Menu());
std::vector<Glib::ustring> temp_mountpoints = selected_filesystem.get_mountpoints();
const std::vector<Glib::ustring>& temp_mountpoints = selected_filesystem.get_mountpoints();
for ( unsigned int t = 0 ; t < temp_mountpoints.size() ; t++ )
{
Gtk::MenuItem *item;
@ -2843,7 +2843,7 @@ void Win_GParted::toggle_crypt_busy_state()
bool Win_GParted::unmount_partition( const Partition & partition, Glib::ustring & error )
{
const std::vector<Glib::ustring> fs_mountpoints = partition.get_mountpoints();
const std::vector<Glib::ustring>& fs_mountpoints = partition.get_mountpoints();
const std::vector<Glib::ustring> all_mountpoints = Mount_Info::get_all_mountpoints();
std::vector<Glib::ustring> skipped_mountpoints;