Skip to content

Commit f1eb71e

Browse files
jiayuebaofacebook-github-bot
authored andcommitted
Correct improper handle->getMemory() and item.getMemory() callsites
Summary: This is the preparation work for `getMemory()`/`getMemoryAs()` APIs (in next diff D30938708): We want read handle (i.e. `const itemHandle`) always return read-only memory and only write handle (i.e. `itemHandle`) can return mutable memory. To fix the existing improper use of getMemory(), this diff: - add `const` when the memory is obtained from read handle - remove `const` if the memory is obtained from write handle Reviewed By: stuclar Differential Revision: D30443160 fbshipit-source-id: 09f8ff9008f949d0d71a42cb461b53f30b941506
1 parent 6ae63ac commit f1eb71e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cachelib/datatype/MapView-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace cachelib {
2121
template <typename K, typename V, typename C>
2222
MapView<K, V, C>::MapView(const Item& parent,
2323
const folly::Range<ChainedItemIter>& children) {
24-
hashtable_ = reinterpret_cast<HashTable*>(parent.getMemory());
24+
hashtable_ = reinterpret_cast<const HashTable*>(parent.getMemory());
2525
numBytes_ += parent.getSize();
2626
for (auto& item : children) {
2727
numBytes_ += item.getSize();

0 commit comments

Comments
 (0)