mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 07:05:33 +02:00
Merge 10.2 into 10.3
This commit is contained in:
commit
43ee6915fa
26 changed files with 115 additions and 167 deletions
|
|
@ -238,9 +238,9 @@ bool String::copy(const String &str)
|
|||
|
||||
bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
|
||||
{
|
||||
DBUG_ASSERT(arg_length < UINT_MAX32);
|
||||
if (alloc(arg_length))
|
||||
return TRUE;
|
||||
DBUG_ASSERT(arg_length < UINT_MAX32);
|
||||
if (Ptr == str && arg_length == uint32(str_length))
|
||||
{
|
||||
/*
|
||||
|
|
@ -257,6 +257,24 @@ bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
Copy string, where strings may overlap.
|
||||
Same as String::copy, but use memmove instead of memcpy to avoid warnings
|
||||
from valgrind
|
||||
*/
|
||||
|
||||
bool String::copy_or_move(const char *str,size_t arg_length, CHARSET_INFO *cs)
|
||||
{
|
||||
DBUG_ASSERT(arg_length < UINT_MAX32);
|
||||
if (alloc(arg_length))
|
||||
return TRUE;
|
||||
if ((str_length=uint32(arg_length)))
|
||||
memmove(Ptr,str,arg_length);
|
||||
Ptr[arg_length]=0;
|
||||
str_charset=cs;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Checks that the source string can be just copied to the destination string
|
||||
|
|
@ -390,8 +408,9 @@ bool String::set_or_copy_aligned(const char *str, size_t arg_length,
|
|||
/* How many bytes are in incomplete character */
|
||||
size_t offset= (arg_length % cs->mbminlen);
|
||||
|
||||
if (!offset) /* All characters are complete, just copy */
|
||||
if (!offset)
|
||||
{
|
||||
/* All characters are complete, just use given string */
|
||||
set(str, arg_length, cs);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue