pnor_partition_table: Improve readability of Table::partition(size_t)
Create a local variable for the partition of interest.
Change-Id: I7c0ec008f8b616cec15f10664afca73736324029
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index a679517..c9ef3a3 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -143,11 +143,11 @@
for (decltype(numParts) i{}; i < numParts; ++i)
{
- if ((blockOffset >= table.partitions[i].data.base) &&
- (blockOffset <
- (table.partitions[i].data.base + table.partitions[i].data.size)))
+ const struct pnor_partition& part = table.partitions[i];
+ if ((blockOffset >= part.data.base) &&
+ (blockOffset < (part.data.base + part.data.size)))
{
- return table.partitions[i];
+ return part;
}
}