[gparted] Return constant reference from OperationDetail::get_description() (!94)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Return constant reference from OperationDetail::get_description() (!94)
- Date: Tue, 16 Nov 2021 19:54:14 +0000 (UTC)
commit 1f6e81295b5190a0a67daf9e85b4206faafb725e
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Nov 6 16:55:01 2021 +0000
Return constant reference from OperationDetail::get_description() (!94)
All uses of get_description() copy construct to a local variable, not
assign to a reference, so this doesn't save anything. It is just being
done to be consistent with making other getters return a constant
reference.
Closes !94 - Make more getter methods use return-by-constant-reference
include/OperationDetail.h | 2 +-
src/OperationDetail.cc | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/include/OperationDetail.h b/include/OperationDetail.h
index 4cdda715..bf898dff 100644
--- a/include/OperationDetail.h
+++ b/include/OperationDetail.h
@@ -58,7 +58,7 @@ public:
OperationDetailStatus status = STATUS_EXECUTE,
Font font = FONT_NORMAL ) ;
void set_description( const Glib::ustring & description, Font font = FONT_NORMAL ) ;
- Glib::ustring get_description() const ;
+ const Glib::ustring& get_description() const;
void set_status( OperationDetailStatus status ) ;
void set_success_and_capture_errors( bool success );
OperationDetailStatus get_status() const ;
diff --git a/src/OperationDetail.cc b/src/OperationDetail.cc
index 1e358650..89c15dc3 100644
--- a/src/OperationDetail.cc
+++ b/src/OperationDetail.cc
@@ -75,11 +75,13 @@ void OperationDetail::set_description( const Glib::ustring & description, Font f
on_update( *this ) ;
}
-Glib::ustring OperationDetail::get_description() const
+
+const Glib::ustring& OperationDetail::get_description() const
{
return description ;
}
-
+
+
void OperationDetail::set_status( OperationDetailStatus status )
{
if ( this ->status != STATUS_ERROR )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]