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.
This commit is contained in:
Mike Fleetwood 2017-09-19 19:51:22 +01:00 committed by Curtis Gedak
parent 25d2aa341c
commit f5d3f97c7a
3 changed files with 6 additions and 11 deletions

View file

@ -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 ;

View file

@ -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:

View file

@ -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() ;
}