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

Closes !94 - Make more getter methods use return-by-constant-reference
This commit is contained in:
Mike Fleetwood 2021-11-01 20:51:37 +00:00 committed by Curtis Gedak
parent 21dd6fe00b
commit 301690d9ff
5 changed files with 7 additions and 6 deletions

View file

@ -110,7 +110,7 @@ public:
void set_path( const Glib::ustring & path );
Byte_Value get_byte_length() const ;
Sector get_sector_length() const ;
Glib::ustring get_path() const ;
const Glib::ustring& get_path() const;
void add_mountpoint( const Glib::ustring & mountpoint );
void add_mountpoints( const std::vector<Glib::ustring> & mountpoints );
Glib::ustring get_mountpoint() const ;

View file

@ -263,7 +263,7 @@ void Dialog_Rescue_Data::check_overlaps(int nPart)
for(unsigned int i=0;i<this->overlappedPartitions.size(); i++)
{
Glib::ustring ovrDevPath=this->device->partitions[i].get_path();
const Glib::ustring& ovrDevPath = this->device->partitions[i].get_path();
Glib::ustring ovrDevMountPoint=this->device->partitions[i].get_mountpoint();
sec_text+="\n"+ovrDevPath+" mounted on "+ovrDevMountPoint;

View file

@ -1040,7 +1040,7 @@ void GParted_Core::set_luks_partition( PartitionLUKS & partition )
void GParted_Core::set_partition_label_and_uuid( Partition & partition )
{
Glib::ustring partition_path = partition.get_path();
const Glib::ustring& partition_path = partition.get_path();
// For SWRaid members only get the label and UUID from SWRaid_Info. Never use
// values from FS_Info to avoid showing incorrect information in cases where blkid
@ -3479,7 +3479,7 @@ bool GParted_Core::calibrate_partition( Partition & partition, OperationDetail &
if ( partition.type == TYPE_PRIMARY || partition.type == TYPE_LOGICAL ||
partition.type == TYPE_EXTENDED || partition.type == TYPE_UNPARTITIONED )
{
Glib::ustring curr_path = partition.get_path();
const Glib::ustring& curr_path = partition.get_path();
operationdetail.add_child( OperationDetail( Glib::ustring::compose( _("calibrate %1"), curr_path ) ) );
bool success = false;

View file

@ -260,7 +260,8 @@ Sector Partition::get_sector_length() const
return -1 ;
}
Glib::ustring Partition::get_path() const
const Glib::ustring& Partition::get_path() const
{
return path;
}

View file

@ -284,7 +284,7 @@ bool btrfs::write_label( const Partition & partition, OperationDetail & operatio
bool btrfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
{
bool success = true ;
Glib::ustring path = partition_new .get_path() ;
const Glib::ustring& path = partition_new.get_path();
BTRFS_Device btrfs_dev = get_cache_entry( path ) ;
if ( btrfs_dev .devid == -1 )