diff options
author | unknown <bar@bar.intranet.mysql.r18.ru> | 2004-01-15 12:12:55 +0400 |
---|---|---|
committer | unknown <bar@bar.intranet.mysql.r18.ru> | 2004-01-15 12:12:55 +0400 |
commit | 4239d4b24f281f9f5c2d21a622b616ac711f9f2e (patch) | |
tree | 1541d2b251d1f02f38618a97c71a67752a11121e /sql/item_strfunc.cc | |
parent | 484cf319c541e3fe49b667dff41099df30a0f947 (diff) | |
download | mariadb-git-4239d4b24f281f9f5c2d21a622b616ac711f9f2e.tar.gz |
item_strfunc.cc:
Unnesessary copying was fixed
sql/item_strfunc.cc:
Unnesessary copying was fixed
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index f810afa3cfa..3b67fd371a4 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -975,16 +975,10 @@ String *Item_func_right::val_str(String *str) if (res->length() <= (uint) length) return res; /* purecov: inspected */ - /* - As far "res" contains at least "length" bytes - (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) + uint start=res->numchars(); + if (start <= (uint) length) return res; - start=res->charpos(start); + start=res->charpos(start - (uint) length); tmp_value.set(*res,start,res->length()-start); return &tmp_value; } |