mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
Clean up ut_strlcpy(), ut_strlcpy_rev()
ut_strlcpy(): Replace with the standard function strncpy(). ut_strlcpy_rev(): Define in the same compilation unit where the only caller resides. Avoid unnecessary definition in non-debug builds.
This commit is contained in:
parent
814534745b
commit
44b0c86971
4 changed files with 15 additions and 73 deletions
|
|
@ -240,6 +240,17 @@ mem_heap_validate(
|
|||
|
||||
ut_ad(size == heap->total_size);
|
||||
}
|
||||
|
||||
/** Copy the tail of a string.
|
||||
@param[in,out] dst destination buffer
|
||||
@param[in] src string whose tail to copy
|
||||
@param[in] size size of dst buffer, in bytes, including NUL terminator
|
||||
@return strlen(src) */
|
||||
static void ut_strlcpy_rev(char* dst, const char* src, ulint size)
|
||||
{
|
||||
size_t src_size = strlen(src), n = std::min(src_size, size - 1);
|
||||
memcpy(dst, src + src_size - n, n + 1);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/***************************************************************//**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue