Commit 199517f5 authored by Monty's avatar Monty

Avoid warnings in String::copy when copying string on itself (ok to do)

parent 5a16fe0e
......@@ -183,7 +183,16 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
{
if (alloc(arg_length))
return TRUE;
if ((str_length=arg_length))
if (Ptr == str && arg_length == str_length)
{
/*
This can happen in some cases. This code is here mainly to avoid
warnings from valgrind, but can also be an indication of error.
*/
DBUG_PRINT("warning", ("Copying string on itself: %p %lu",
str, arg_length));
}
else if ((str_length=arg_length))
memcpy(Ptr,str,arg_length);
Ptr[arg_length]=0;
str_charset=cs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment