This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 5712cbdc refactor: rename variable names for clarity in LCS method 
(#2392)
5712cbdc is described below

commit 5712cbdcced08a6ce648fda7eec49f2d6f78b393
Author: ZhangJian He <[email protected]>
AuthorDate: Tue Jul 2 22:42:56 2024 +0800

    refactor: rename variable names for clarity in LCS method (#2392)
---
 .github/workflows/kvrocks.yaml |  2 +-
 src/types/redis_string.cc      | 36 ++++++++++++++++++------------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml
index 18089d5f..06762033 100644
--- a/.github/workflows/kvrocks.yaml
+++ b/.github/workflows/kvrocks.yaml
@@ -58,7 +58,7 @@ jobs:
     steps:
       - uses: actions/checkout@v4
       - name: Check typos
-        uses: crate-ci/[email protected]
+        uses: crate-ci/[email protected]
         with:
           config: .github/config/typos.toml
 
diff --git a/src/types/redis_string.cc b/src/types/redis_string.cc
index b934f3b8..43cf2a30 100644
--- a/src/types/redis_string.cc
+++ b/src/types/redis_string.cc
@@ -597,10 +597,10 @@ rocksdb::Status String::LCS(const std::string &user_key1, 
const std::string &use
 
   uint32_t i = alen;
   uint32_t j = blen;
-  uint32_t arange_start = alen;  // alen signals that values are not set.
-  uint32_t arange_end = 0;
-  uint32_t brange_start = 0;
-  uint32_t brange_end = 0;
+  uint32_t a_range_start = alen;  // alen signals that values are not set.
+  uint32_t a_range_end = 0;
+  uint32_t b_range_start = 0;
+  uint32_t b_range_end = 0;
   while (i > 0 && j > 0) {
     bool emit_range = false;
     if (a[i - 1] == b[j - 1]) {
@@ -611,24 +611,24 @@ rocksdb::Status String::LCS(const std::string &user_key1, 
const std::string &use
       }
 
       // Track the current range.
-      if (arange_start == alen) {
-        arange_start = i - 1;
-        arange_end = i - 1;
-        brange_start = j - 1;
-        brange_end = j - 1;
+      if (a_range_start == alen) {
+        a_range_start = i - 1;
+        a_range_end = i - 1;
+        b_range_start = j - 1;
+        b_range_end = j - 1;
       }
       // Let's see if we can extend the range backward since
       // it is contiguous.
-      else if (arange_start == i && brange_start == j) {
-        arange_start--;
-        brange_start--;
+      else if (a_range_start == i && b_range_start == j) {
+        a_range_start--;
+        b_range_start--;
       } else {
         emit_range = true;
       }
 
       // Emit the range if we matched with the first byte of
       // one of the two strings. We'll exit the loop ASAP.
-      if (arange_start == 0 || brange_start == 0) {
+      if (a_range_start == 0 || b_range_start == 0) {
         emit_range = true;
       }
       idx--;
@@ -643,23 +643,23 @@ rocksdb::Status String::LCS(const std::string &user_key1, 
const std::string &use
         i--;
       else
         j--;
-      if (arange_start != alen) emit_range = true;
+      if (a_range_start != alen) emit_range = true;
     }
 
     // Emit the current range if needed.
     if (emit_range) {
       if (auto result = std::get_if<StringLCSIdxResult>(rst)) {
-        uint32_t match_len = arange_end - arange_start + 1;
+        uint32_t match_len = a_range_end - a_range_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},
-                                       StringLCSRange{brange_start, 
brange_end}, match_len);
+          result->matches.emplace_back(StringLCSRange{a_range_start, 
a_range_end},
+                                       StringLCSRange{b_range_start, 
b_range_end}, match_len);
         }
       }
 
       // Restart at the next match.
-      arange_start = alen;
+      a_range_start = alen;
     }
   }
 

Reply via email to