Commit 4239d4b2 authored by unknown's avatar unknown

item_strfunc.cc:

  Unnesessary copying was fixed


sql/item_strfunc.cc:
  Unnesessary copying was fixed
parent 484cf319
...@@ -975,16 +975,10 @@ String *Item_func_right::val_str(String *str) ...@@ -975,16 +975,10 @@ String *Item_func_right::val_str(String *str)
if (res->length() <= (uint) length) if (res->length() <= (uint) length)
return res; /* purecov: inspected */ return res; /* purecov: inspected */
/* uint start=res->numchars();
As far "res" contains at least "length" bytes if (start <= (uint) length)
(according to the above condition and return),
the below statement is safe. res->numchars() can
never return a value more than "length".
*/
uint start=res->numchars()-(uint) length;
if (!start)
return res; return res;
start=res->charpos(start); start=res->charpos(start - (uint) length);
tmp_value.set(*res,start,res->length()-start); tmp_value.set(*res,start,res->length()-start);
return &tmp_value; return &tmp_value;
} }
......
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