Skip to content

Commit

Permalink
Move the match_len to the inside block
Browse files Browse the repository at this point in the history
  • Loading branch information
JoverZhang committed Mar 3, 2024
1 parent 0474d4b commit 910530e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types/redis_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,10 @@ rocksdb::Status String::LCS(const std::string &user_key1, const std::string &use
}

// Emit the current range if needed.
uint32_t match_len = arange_end - arange_start + 1;
if (emit_range) {
if (auto result = std::get_if<StringLCSIdxResult>(rst)) {
uint32_t match_len = arange_end - arange_start + 1;

// Always emit the range when the `min_match_len` is not set.
if (args.min_match_len == 0 || match_len >= args.min_match_len) {
result->matches.emplace_back(StringLCSRange{arange_start, arange_end},
Expand Down

0 comments on commit 910530e

Please sign in to comment.