[gparted] Pass string literals directly to execute_command()
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Pass string literals directly to execute_command()
- Date: Mon, 25 Sep 2017 15:33:04 +0000 (UTC)
commit f5d3f97c7a6af17c82485616f6bf073c8e64b2c6
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Tue Sep 19 19:51:22 2017 +0100
Pass string literals directly to execute_command()
There were a few cases of creating a local string variable from a
literal and then passing the variable to execute_command() like this:
Glib::ustring cmd = "whatever";
Utils::execute_command( cmd, ... );
This creates an unnecessary local variable. Instead pass the string
literal directly to Utils::execute_command() like this:
Utils::execute_command( "whatever", ... );
This also make the code a little bit more grep friendly.
src/DMRaid.cc | 9 +++------
src/SWRaid_Info.cc | 4 ++--
src/Win_GParted.cc | 4 +---
3 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/DMRaid.cc b/src/DMRaid.cc
index 456490d..59bef34 100644
--- a/src/DMRaid.cc
+++ b/src/DMRaid.cc
@@ -322,7 +322,6 @@ bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetai
{
//Create all missing dev mapper entries for a specified device.
- Glib::ustring command ;
bool exit_status = true ;
/*TO TRANSLATORS: looks like create missing /dev/mapper entries */
@@ -331,8 +330,7 @@ bool DMRaid::create_dev_map_entries( const Partition & partition, OperationDetai
//Newer dmraid defaults to always inserting the letter 'p' between the device name
// and the partition number.
- command = "dmraid -ay -P \"\" -v" ;
- if ( execute_command( command, operationdetail .get_last_child() ) )
+ if ( execute_command( "dmraid -ay -P \"\" -v", operationdetail.get_last_child() ) )
exit_status = false; // command failed
operationdetail .get_last_child() .set_status( exit_status ? STATUS_SUCCES : STATUS_ERROR ) ;
@@ -344,13 +342,12 @@ bool DMRaid::create_dev_map_entries( const Glib::ustring & dev_path )
{
//Create all missing dev mapper entries for a specified device.
- Glib::ustring command, output, error ;
+ Glib::ustring output, error ;
bool exit_status = true ;
//Newer dmraid defaults to always inserting the letter 'p' between the device name
// and the partition number.
- command = "dmraid -ay -P \"\" -v" ;
- if ( Utils::execute_command( command, output, error, true ) )
+ if ( Utils::execute_command( "dmraid -ay -P \"\" -v", output, error, true ) )
exit_status = false; // command failed
return exit_status ;
diff --git a/src/SWRaid_Info.cc b/src/SWRaid_Info.cc
index 7e7e27d..ef4b0ef 100644
--- a/src/SWRaid_Info.cc
+++ b/src/SWRaid_Info.cc
@@ -125,8 +125,8 @@ void SWRaid_Info::load_swraid_info_cache()
// Load SWRaid members into the cache. Load member device, array UUID and array
// label (array name in mdadm terminology).
- Glib::ustring cmd = "mdadm --examine --scan --verbose";
- if ( mdadm_found && ! Utils::execute_command( cmd, output, error, true ) )
+ if ( mdadm_found &&
+ ! Utils::execute_command( "mdadm --examine --scan --verbose", output, error, true ) )
{
// Extract information from Linux Software RAID arrays only, excluding
// IMSM and DDF arrays. Example output:
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 7fd289b..56937ce 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -2772,9 +2772,7 @@ void Win_GParted::activate_attempt_rescue_data()
dialog.run();
dialog.hide();
- Glib::ustring commandUmount= "umount /tmp/gparted-roview*";
-
- Utils::execute_command(commandUmount);
+ Utils::execute_command( "umount /tmp/gparted-roview*" );
menu_gparted_refresh_devices() ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]