Constify string parameters to add_mountpoint_entry()

add_mountpoint_entry() doesn't modify the passed strings so use
pass-by-constant-reference.  This avoids pass-by-value and having to
construct copies of the strings just to pass them to this method.
This commit is contained in:
Mike Fleetwood 2022-05-27 22:49:14 +01:00 committed by Curtis Gedak
parent 59b3fd068f
commit 12e709920b
2 changed files with 8 additions and 8 deletions

View File

@ -58,10 +58,10 @@ public:
private:
static void read_mountpoints_from_file( const Glib::ustring & filename, MountMapping & map );
static void add_mountpoint_entry( MountMapping & map,
Glib::ustring & node,
bool readonly,
Glib::ustring& mountpoint);
static void add_mountpoint_entry(MountMapping& map,
const Glib::ustring& node,
bool readonly,
const Glib::ustring& mountpoint);
static bool parse_readonly_flag( const Glib::ustring & str );
static void read_mountpoints_from_file_swaps( const Glib::ustring & filename,
MountMapping & map );

View File

@ -172,10 +172,10 @@ void Mount_Info::read_mountpoints_from_file( const Glib::ustring & filename, Mou
}
void Mount_Info::add_mountpoint_entry( MountMapping & map,
Glib::ustring & node,
bool readonly,
Glib::ustring& mountpoint)
void Mount_Info::add_mountpoint_entry(MountMapping& map,
const Glib::ustring& node,
bool readonly,
const Glib::ustring& mountpoint)
{
// Only add node path if mount point exists
if ( file_test( mountpoint, Glib::FILE_TEST_EXISTS ) )