33//
44#include " core/detail/listpack_wrap.h"
55
6- #include " server/container_utils .h"
6+ #include " base/logging .h"
77
88extern " C" {
99#include " redis/listpack.h"
@@ -27,10 +27,9 @@ void ListpackWrap::Iterator::Read() {
2727 if (!ptr_)
2828 return ;
2929
30- using container_utils::LpGetView;
31- key_v_ = LpGetView (ptr_, intbuf_[0 ]);
30+ key_v_ = GetView (ptr_, intbuf_[0 ]);
3231 next_ptr_ = lpNext (lp_, ptr_);
33- value_v_ = LpGetView (next_ptr_, intbuf_[1 ]);
32+ value_v_ = GetView (next_ptr_, intbuf_[1 ]);
3433 next_ptr_ = lpNext (lp_, next_ptr_);
3534}
3635
@@ -115,6 +114,13 @@ ListpackWrap::Iterator ListpackWrap::end() const {
115114 return Iterator{lp_, nullptr , intbuf_};
116115}
117116
117+ std::string_view ListpackWrap::GetView (uint8_t * lp_it, uint8_t int_buf[]) {
118+ int64_t ele_len = 0 ;
119+ uint8_t * elem = lpGet (lp_it, &ele_len, int_buf);
120+ DCHECK (elem);
121+ return std::string_view{reinterpret_cast <char *>(elem), size_t (ele_len)};
122+ }
123+
118124bool ListpackWrap::Iterator::operator ==(const Iterator& other) const {
119125 return lp_ == other.lp_ && ptr_ == other.ptr_ ;
120126}
0 commit comments