From 288d027e892959f84cb0aead7570f8f789663f3a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 10 Jun 2019 23:02:48 -0400 Subject: file_sys/card_image: Deduplicate type cast Same thing, less duplication. We can also std::move raw into the PartitionFilesystem constructor. --- src/core/file_sys/card_image.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index fd00e5457..4375e01fa 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp @@ -48,10 +48,12 @@ XCI::XCI(VirtualFile file_) for (XCIPartition partition : {XCIPartition::Update, XCIPartition::Normal, XCIPartition::Secure, XCIPartition::Logo}) { - auto raw = main_hfs.GetFile(partition_names[static_cast(partition)]); - if (raw != nullptr) - partitions[static_cast(partition)] = - std::make_shared(raw); + const auto partition_idx = static_cast(partition); + auto raw = main_hfs.GetFile(partition_names[partition_idx]); + + if (raw != nullptr) { + partitions[partition_idx] = std::make_shared(std::move(raw)); + } } secure_partition = std::make_shared( -- cgit v1.2.3