mirror of
https://github.com/ceph/ceph
synced 2025-04-01 23:02:17 +00:00
buffer: rename iterator copy() to copy_deep()
Current callers expect a deep copy; be explicit about it. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
1917d85392
commit
6d7f748653
@ -384,7 +384,7 @@ void CryptoKey::decode(bufferlist::iterator& bl)
|
||||
__u16 len;
|
||||
::decode(len, bl);
|
||||
bufferptr tmp;
|
||||
bl.copy(len, tmp);
|
||||
bl.copy_deep(len, tmp);
|
||||
if (_set_secret(type, tmp) < 0)
|
||||
throw buffer::malformed_input("malformed secret");
|
||||
}
|
||||
|
@ -1149,8 +1149,11 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
|
||||
}
|
||||
|
||||
template<bool is_const>
|
||||
void buffer::list::iterator_impl<is_const>::copy(unsigned len, ptr &dest)
|
||||
void buffer::list::iterator_impl<is_const>::copy_deep(unsigned len, ptr &dest)
|
||||
{
|
||||
if (p == ls->end())
|
||||
throw end_of_buffer();
|
||||
assert(p->length() > 0);
|
||||
dest = create(len);
|
||||
copy(len, dest.c_str());
|
||||
}
|
||||
@ -1298,9 +1301,14 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
|
||||
return buffer::list::iterator_impl<false>::copy(len, dest);
|
||||
}
|
||||
|
||||
void buffer::list::iterator::copy(unsigned len, ptr &dest)
|
||||
void buffer::list::iterator::copy_deep(unsigned len, ptr &dest)
|
||||
{
|
||||
buffer::list::iterator_impl<false>::copy(len, dest);
|
||||
buffer::list::iterator_impl<false>::copy_deep(len, dest);
|
||||
}
|
||||
|
||||
void buffer::list::iterator::copy_shallow(unsigned len, ptr &dest)
|
||||
{
|
||||
buffer::list::iterator_impl<false>::copy_shallow(len, dest);
|
||||
}
|
||||
|
||||
void buffer::list::iterator::copy(unsigned len, list &dest)
|
||||
|
@ -320,7 +320,7 @@ namespace buffer CEPH_BUFFER_API {
|
||||
// copy data out.
|
||||
// note that these all _append_ to dest!
|
||||
void copy(unsigned len, char *dest);
|
||||
void copy(unsigned len, ptr &dest);
|
||||
void copy_deep(unsigned len, ptr &dest);
|
||||
void copy(unsigned len, list &dest);
|
||||
void copy(unsigned len, std::string &dest);
|
||||
void copy_all(list &dest);
|
||||
@ -360,7 +360,7 @@ namespace buffer CEPH_BUFFER_API {
|
||||
|
||||
// copy data out
|
||||
void copy(unsigned len, char *dest);
|
||||
void copy(unsigned len, ptr &dest);
|
||||
void copy_deep(unsigned len, ptr &dest);
|
||||
void copy(unsigned len, list &dest);
|
||||
void copy(unsigned len, std::string &dest);
|
||||
void copy_all(list &dest);
|
||||
|
@ -251,7 +251,7 @@ template<typename T>
|
||||
inline void small_decode_buf_lowz(T& bp, bufferlist::iterator& p) {
|
||||
size_t l;
|
||||
small_decode_varint_lowz(l, p);
|
||||
p.copy(l, bp);
|
||||
p.copy_deep(l, bp);
|
||||
}
|
||||
|
||||
// STL containers
|
||||
|
@ -1216,12 +1216,12 @@ TEST(BufferListIterator, copy) {
|
||||
EXPECT_EQ(0, ::memcmp(copy, expected, 3));
|
||||
}
|
||||
//
|
||||
// void buffer::list::iterator::copy(unsigned len, ptr &dest)
|
||||
// void buffer::list::iterator::copy_deep(unsigned len, ptr &dest)
|
||||
//
|
||||
{
|
||||
bufferptr ptr;
|
||||
bufferlist::iterator i(&bl);
|
||||
i.copy(2, ptr);
|
||||
i.copy_deep(2, ptr);
|
||||
EXPECT_EQ((unsigned)2, ptr.length());
|
||||
EXPECT_EQ('A', ptr[0]);
|
||||
EXPECT_EQ('B', ptr[1]);
|
||||
|
@ -550,7 +550,7 @@ void TestMemIoCtxImpl::append_clone(bufferlist& src, bufferlist* dest) {
|
||||
if (src.length() > 0) {
|
||||
bufferlist::iterator iter = src.begin();
|
||||
buffer::ptr ptr;
|
||||
iter.copy(src.length(), ptr);
|
||||
iter.copy_deep(src.length(), ptr);
|
||||
dest->append(ptr);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user