[gparted] Constify string parameters to add_mountpoint_entry()
- From: Mike Fleetwood <mfleetwo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Constify string parameters to add_mountpoint_entry()
- Date: Tue, 31 May 2022 20:57:44 +0000 (UTC)
commit 12e709920bd69ec6923cd82fe5234c1544c632d3
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Fri May 27 22:49:14 2022 +0100
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.
include/Mount_Info.h | 8 ++++----
src/Mount_Info.cc | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/include/Mount_Info.h b/include/Mount_Info.h
index ae4a6513..a39dc279 100644
--- a/include/Mount_Info.h
+++ b/include/Mount_Info.h
@@ -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 );
diff --git a/src/Mount_Info.cc b/src/Mount_Info.cc
index 81dd5e44..c3d5a7cd 100644
--- a/src/Mount_Info.cc
+++ b/src/Mount_Info.cc
@@ -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 ) )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]