[gparted] Refactor reiser4::read_uuid() into if fail return early pattern
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Refactor reiser4::read_uuid() into if fail return early pattern
- Date: Wed, 24 Mar 2021 16:46:52 +0000 (UTC)
commit 2a76af5beb4c609b372e635ef7a7d3dc68632104
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Mar 20 15:45:50 2021 +0000
Refactor reiser4::read_uuid() into if fail return early pattern
src/reiser4.cc | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/reiser4.cc b/src/reiser4.cc
index 30e68e63..ed4e1c6c 100644
--- a/src/reiser4.cc
+++ b/src/reiser4.cc
@@ -127,23 +127,24 @@ void reiser4::read_label( Partition & partition )
}
}
+
void reiser4::read_uuid( Partition & partition )
{
- if ( ! Utils::execute_command( "debugfs.reiser4 " + Glib::shell_quote( partition.get_path() ),
- output, error, true ) )
+ exit_status = Utils::execute_command("debugfs.reiser4 " + Glib::shell_quote( partition.get_path()),
+ output, error, true);
+ if (exit_status != 0)
{
- partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*("
RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
+ if (! output.empty())
+ partition.push_back_message(output);
+ if (! error.empty())
+ partition.push_back_message(error);
+ return;
}
- else
- {
- if ( ! output .empty() )
- partition.push_back_message( output );
- if ( ! error .empty() )
- partition.push_back_message( error );
- }
+ partition.uuid = Utils::regexp_label(output, "uuid:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")");
}
+
bool reiser4::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkfs.reiser4 --force --yes --label " +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]