mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 23:54:31 +02:00
MDEV-30289 fixup: Clean up mtr_buf_t further
mtr_buf_t::at(), mtr_buf_t::find(): Unused functions, removed.
mtr_buf_t::push(): Invoke memcpy(), not memmove().
Fixes up commit 67dc8af2a7 (MDEV-30289).
This commit is contained in:
parent
069b510443
commit
8c3f6a1b85
1 changed files with 1 additions and 49 deletions
|
|
@ -257,38 +257,13 @@ public:
|
|||
while (len > 0) {
|
||||
uint32_t n_copied = std::min(len,
|
||||
uint32_t(MAX_DATA_SIZE));
|
||||
::memmove(push<byte*>(n_copied), ptr, n_copied);
|
||||
::memcpy(push<byte*>(n_copied), ptr, n_copied);
|
||||
|
||||
ptr += n_copied;
|
||||
len -= n_copied;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to an element in the buffer. const version.
|
||||
@param pos position of element in bytes from start
|
||||
@return pointer to element */
|
||||
template <typename Type>
|
||||
const Type at(ulint pos) const
|
||||
{
|
||||
block_t* block = const_cast<block_t*>(
|
||||
const_cast<mtr_buf_t*>(this)->find(pos));
|
||||
|
||||
return(reinterpret_cast<Type>(block->begin() + pos));
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a pointer to an element in the buffer. non const version.
|
||||
@param pos position of element in bytes from start
|
||||
@return pointer to element */
|
||||
template <typename Type>
|
||||
Type at(ulint pos)
|
||||
{
|
||||
block_t* block = const_cast<block_t*>(find(pos));
|
||||
|
||||
return(reinterpret_cast<Type>(block->begin() + pos));
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the size of the total stored data.
|
||||
@return data size in bytes */
|
||||
|
|
@ -377,29 +352,6 @@ private:
|
|||
return(back()->m_used + size <= MAX_DATA_SIZE);
|
||||
}
|
||||
|
||||
/** Find the block that contains the pos.
|
||||
@param pos absolute offset, it is updated to make it relative
|
||||
to the block
|
||||
@return the block containing the pos. */
|
||||
block_t* find(ulint& pos)
|
||||
{
|
||||
ut_ad(!m_list.empty());
|
||||
|
||||
for (list_t::iterator it = m_list.begin(), end = m_list.end();
|
||||
it != end; ++it) {
|
||||
|
||||
if (pos < it->used()) {
|
||||
ut_ad(it->used() >= pos);
|
||||
|
||||
return &*it;
|
||||
}
|
||||
|
||||
pos -= it->used();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
Allocate and add a new block to m_list */
|
||||
block_t* add_block()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue