Skip to content

Commit

Permalink
clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
ban-nobuhiro committed Feb 12, 2025
1 parent be3c0d4 commit e92907d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/concurrency_control/interface/scan/open_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,18 @@ constexpr Status check_empty_scan_range(const std::string_view l_key, const scan
}
if (l_end == scan_endpoint::INF) {
// if left end is inf, not empty in most cases
if (r_end == scan_endpoint::EXCLUSIVE && r_key == "") {
return Status::WARN_NOT_FOUND; // exception
if (r_end == scan_endpoint::EXCLUSIVE && r_key.empty()) {
return Status::WARN_NOT_FOUND; // the only exception
}
return Status::OK;
}
int cmp_key = l_key.compare(r_key);
if (cmp_key < 0) { return Status::OK; } // if left is less, not empty
if (cmp_key > 0) { return Status::WARN_NOT_FOUND; } // if left is greater, invalid range
// l_key == r_key
if (l_end == scan_endpoint::INCLUSIVE && r_end == scan_endpoint::INCLUSIVE) {
return Status::OK; // single point, not empty
} else {
return Status::WARN_NOT_FOUND; // empty
}
return (l_end == scan_endpoint::INCLUSIVE && r_end == scan_endpoint::INCLUSIVE)
? Status::OK // single point, not empty
: Status::WARN_NOT_FOUND; // empty
}

/**
Expand Down

0 comments on commit e92907d

Please sign in to comment.