Remove unnecessary computation of index (#6406)
Summary: `index` can be replaced by `iter`, saving the computation of `index++`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6406 Test Plan: make check Differential Revision: D19905056 Pulled By: cheng-chang fbshipit-source-id: add4638959c0d2e4e77a11f3fa04ffabaf0de790
This commit is contained in:
parent
4034e289ad
commit
152f8a8ffe
@ -94,8 +94,6 @@ class MultiGetContext {
|
||||
: num_keys_(num_keys),
|
||||
value_mask_(0),
|
||||
lookup_key_ptr_(reinterpret_cast<LookupKey*>(lookup_key_stack_buf)) {
|
||||
int index = 0;
|
||||
|
||||
if (num_keys > MAX_LOOKUP_KEYS_ON_STACK) {
|
||||
lookup_key_heap_buf.reset(new char[sizeof(LookupKey) * num_keys]);
|
||||
lookup_key_ptr_ = reinterpret_cast<LookupKey*>(
|
||||
@ -105,11 +103,10 @@ class MultiGetContext {
|
||||
for (size_t iter = 0; iter != num_keys_; ++iter) {
|
||||
// autovector may not be contiguous storage, so make a copy
|
||||
sorted_keys_[iter] = (*sorted_keys)[begin + iter];
|
||||
sorted_keys_[iter]->lkey = new (&lookup_key_ptr_[index])
|
||||
sorted_keys_[iter]->lkey = new (&lookup_key_ptr_[iter])
|
||||
LookupKey(*sorted_keys_[iter]->key, snapshot);
|
||||
sorted_keys_[iter]->ukey = sorted_keys_[iter]->lkey->user_key();
|
||||
sorted_keys_[iter]->ikey = sorted_keys_[iter]->lkey->internal_key();
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user