[gparted] Return and use constant reference from Partition::get_path() (!94)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Return and use constant reference from Partition::get_path() (!94)
- Date: Tue, 16 Nov 2021 19:54:14 +0000 (UTC)
commit 301690d9ff7be909adf8afe6d0a7672221063bfe
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Mon Nov 1 20:51:37 2021 +0000
Return and use constant reference from Partition::get_path() (!94)
Closes !94 - Make more getter methods use return-by-constant-reference
include/Partition.h | 2 +-
src/Dialog_Rescue_Data.cc | 2 +-
src/GParted_Core.cc | 4 ++--
src/Partition.cc | 3 ++-
src/btrfs.cc | 2 +-
5 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/include/Partition.h b/include/Partition.h
index 13f95751..72a9d7ce 100644
--- a/include/Partition.h
+++ b/include/Partition.h
@@ -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 ;
diff --git a/src/Dialog_Rescue_Data.cc b/src/Dialog_Rescue_Data.cc
index 2aaf6bec..e3a343af 100644
--- a/src/Dialog_Rescue_Data.cc
+++ b/src/Dialog_Rescue_Data.cc
@@ -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;
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index b247105a..159bafae 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -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;
diff --git a/src/Partition.cc b/src/Partition.cc
index ebf3b25c..dde1ffc8 100644
--- a/src/Partition.cc
+++ b/src/Partition.cc
@@ -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;
}
diff --git a/src/btrfs.cc b/src/btrfs.cc
index b8c72086..8d66fedf 100644
--- a/src/btrfs.cc
+++ b/src/btrfs.cc
@@ -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 )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]