From 5f4ee39d143e50c5e879fee25cdcd3ce255a965f Mon Sep 17 00:00:00 2001
From: Kushal Singh <kushal.singh@students.iiit.ac.in>
Date: Wed, 18 Feb 2015 22:37:04 +0530
Subject: [PATCH] * Minor code cleaning to make the checking conditions easier
to understand.
---
.../disk_systems/intel/PartitionMapAddOn.cpp | 37 +++++++++++++---------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
index aaa9264..1480528 100644
a
|
b
|
status_t
|
106 | 106 | PartitionMapAddOn::ValidateInitialize(const BMutablePartition* partition, |
107 | 107 | BString* name, const char* parameters) |
108 | 108 | { |
109 | | if (!CanInitialize(partition) |
110 | | || (parameters != NULL && parameters[0] != '\0')) { |
| 109 | if (!CanInitialize(partition)) |
111 | 110 | return B_BAD_VALUE; |
112 | | } |
113 | | |
114 | | // we don't support a content name |
115 | | if (name != NULL) |
116 | | name->Truncate(0); |
117 | | |
118 | | return B_OK; |
| 111 | |
| 112 | // Disk System does not suppport setting parameters. |
| 113 | if (parameters != NULL && parameters[0] != '\0') |
| 114 | return B_BAD_VALUE; |
| 115 | |
| 116 | // Disk System does not support a content name. |
| 117 | if (name != NULL) |
| 118 | name->Truncate(0); |
| 119 | |
| 120 | return B_OK; |
119 | 121 | } |
120 | | |
121 | | |
| 122 | |
| 123 | |
122 | 124 | status_t |
123 | 125 | PartitionMapAddOn::Initialize(BMutablePartition* partition, const char* name, |
124 | 126 | const char* parameters, BPartitionHandle** _handle) |
125 | 127 | { |
126 | | if (!CanInitialize(partition) |
127 | | || (name != NULL && name[0] != '\0') |
128 | | || (parameters != NULL && parameters[0] != '\0')) { |
| 128 | if (!CanInitialize(partition)) |
| 129 | return B_BAD_VALUE; |
| 130 | |
| 131 | // Disk System does not suppport setting parameters. |
| 132 | if (parameters != NULL && parameters[0] != '\0') |
| 133 | return B_BAD_VALUE; |
| 134 | |
| 135 | // Disk System does not support a content name. |
| 136 | if (name != NULL && name[0] != '\0') |
129 | 137 | return B_BAD_VALUE; |
130 | | } |
131 | 138 | |
132 | 139 | // create the handle |
133 | 140 | PartitionMapHandle* handle = new(nothrow) PartitionMapHandle(partition); |