Return and use constant reference from SWRaid::get_array() (!94)
Have to use a second constant reference variable array_path_2 in GParted_Core::set_mountpoints() because by design C++ does not implement rebinding of references [1]. [1] why doesn't C++ allow rebinding a reference? https://stackoverflow.com/questions/27037744/why-doesnt-c-allow-rebinding-a-reference Closes !94 - Make more getter methods use return-by-constant-reference
This commit is contained in:
parent
901f03c19d
commit
b38ee9c8ac
|
@ -59,7 +59,7 @@ public:
|
|||
static bool is_member( const Glib::ustring & member_path );
|
||||
static bool is_member_active( const Glib::ustring & member_path );
|
||||
static FSType get_fstype(const Glib::ustring& member_path);
|
||||
static Glib::ustring get_array( const Glib::ustring & member_path );
|
||||
static const Glib::ustring& get_array(const Glib::ustring& member_path);
|
||||
static Glib::ustring get_uuid( const Glib::ustring & member_path );
|
||||
static Glib::ustring get_label( const Glib::ustring & member_path );
|
||||
|
||||
|
|
|
@ -1469,22 +1469,22 @@ void GParted_Core::set_mountpoints( Partition & partition )
|
|||
}
|
||||
else if (partition.fstype == FS_LINUX_SWRAID)
|
||||
{
|
||||
Glib::ustring array_path = SWRaid_Info::get_array( partition.get_path() );
|
||||
const Glib::ustring& array_path = SWRaid_Info::get_array(partition.get_path());
|
||||
if ( ! array_path.empty() )
|
||||
partition.add_mountpoint( array_path );
|
||||
}
|
||||
else if (partition.fstype == FS_ATARAID)
|
||||
{
|
||||
Glib::ustring array_path = SWRaid_Info::get_array(partition.get_path());
|
||||
const Glib::ustring& array_path = SWRaid_Info::get_array(partition.get_path());
|
||||
if (! array_path.empty())
|
||||
{
|
||||
partition.add_mountpoint(array_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
array_path = dmraid.get_array(partition.get_path());
|
||||
if (! array_path.empty())
|
||||
partition.add_mountpoint(array_path);
|
||||
const Glib::ustring& array_path_2 = dmraid.get_array(partition.get_path());
|
||||
if (! array_path_2.empty())
|
||||
partition.add_mountpoint(array_path_2);
|
||||
}
|
||||
}
|
||||
else if (partition.fstype == FS_LUKS)
|
||||
|
|
|
@ -86,7 +86,7 @@ FSType SWRaid_Info::get_fstype(const Glib::ustring& member_path)
|
|||
|
||||
// Return array /dev entry (e.g. "/dev/md1") containing the specified member, or "" if the
|
||||
// array is not running or there is no such member.
|
||||
Glib::ustring SWRaid_Info::get_array( const Glib::ustring & member_path )
|
||||
const Glib::ustring& SWRaid_Info::get_array(const Glib::ustring& member_path)
|
||||
{
|
||||
initialise_if_required();
|
||||
const SWRaid_Member & memb = get_cache_entry_by_member( member_path );
|
||||
|
|
Loading…
Reference in New Issue