Skip to content

Commit

Permalink
Merge pull request #392 from openzim/no_optional
Browse files Browse the repository at this point in the history
Do not use `std::optional`.
  • Loading branch information
mgautierfr authored Dec 18, 2023
2 parents bb6d10f + 3f6e146 commit e1d407b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/zimcheck/checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <mutex>
#include <thread>
#include <queue>
#include <optional>
#include <zim/archive.h>
#include <zim/item.h>

Expand Down Expand Up @@ -476,7 +475,7 @@ void ArticleChecker::detect_redundant_articles()
const auto e1 = archive.getEntryByPath(l.front()).getItem();
l.pop_front();
if ( !l.empty() ) {
std::optional<std::string> s1;
std::unique_ptr<std::string> s1;
decltype(l) articlesDifferentFromE1;
for(auto other : l) {
// The way we have constructed `l`, e2 MUST BE an item
Expand All @@ -485,10 +484,10 @@ void ArticleChecker::detect_redundant_articles()
continue;
}
if (!s1) {
s1 = e1.getData();
s1 = std::make_unique<std::string>(e1.getData());
}
std::string s2 = e2.getData();
if (s1 != s2 ) {
if (*s1 != s2 ) {
articlesDifferentFromE1.push_back(other);
continue;
}
Expand Down

0 comments on commit e1d407b

Please sign in to comment.