You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/08/11 16:04:44 UTC

[GitHub] [incubator-kvrocks] mapleFU commented on a diff in pull request #775: Fix some typos, and eliminate copy string in `List`

mapleFU commented on code in PR #775:
URL: https://github.com/apache/incubator-kvrocks/pull/775#discussion_r943660970


##########
src/redis_cmd.cc:
##########
@@ -1602,17 +1602,22 @@ class CommandBPop : public Commander {
 
   rocksdb::Status TryPopFromList() {
     Redis::List list_db(svr_->storage_, conn_->GetNamespace());
-    std::string last_key, elem;
+    std::string elem;
+    std::string* last_key_ptr = nullptr;
     rocksdb::Status s;
     for (const auto &key : keys_) {
-      last_key = key;
+      last_key = &key;
       s = list_db.Pop(key, left_, &elem);
       if (s.ok() || !s.IsNotFound()) {
         break;
       }
     }
     if (s.ok()) {
-      conn_->Reply(Redis::MultiBulkString({last_key, elem}));
+      if (last_key_ptr == nullptr) {

Review Comment:
   I found that sometimes kvrocks uses ` == nullptr`, sometimes just use `(ptr)`, I don't know which is better in this project



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org