From 8f0073eda5855244babab50e11ae6e5bdb91540f Mon Sep 17 00:00:00 2001 From: m-holger Date: Tue, 19 Aug 2025 20:14:48 +0100 Subject: [PATCH] Refactor `NNTreeIterator::lastPathElement`: simplify logic with conditional `std::prev` usage. --- libqpdf/NNTree.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libqpdf/NNTree.cc b/libqpdf/NNTree.cc index 8a0bbbc..78098d6 100644 --- a/libqpdf/NNTree.cc +++ b/libqpdf/NNTree.cc @@ -337,11 +337,7 @@ NNTreeIterator::split(Dictionary to_split, std::list::iterator pare std::list::iterator NNTreeIterator::lastPathElement() { - auto result = path.end(); - if (!path.empty()) { - --result; - } - return result; + return path.empty() ? path.end() : std::prev(path.end()); } void -- libgit2 0.21.4