Commit 59b51e6a authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: Field_set::empty_set_string

in particular, it overwrites pre-allocated buffer in val_buffer,
so following val_buffer->append()'s cause totally unnecessary
mallocs.
parent 3648b333
......@@ -9381,16 +9381,6 @@ String *Field_set::val_str(String *val_buffer,
ulonglong tmp=(ulonglong) Field_enum::val_int();
uint bitnr=0;
/*
Some callers expect *val_buffer to contain the result,
so we assign to it, rather than doing 'return &empty_set_string.
*/
*val_buffer= empty_set_string;
if (tmp == 0)
{
return val_buffer;
}
val_buffer->set_charset(field_charset());
val_buffer->length(0);
......
......@@ -4809,8 +4809,7 @@ class Field_set final :public Field_enum {
const LEX_CSTRING *field_name_arg, uint32 packlength_arg,
const TYPELIB *typelib_arg, const DTCollation &collation)
:Field_enum(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
field_name_arg, packlength_arg, typelib_arg, collation),
empty_set_string("", 0, collation.collation)
field_name_arg, packlength_arg, typelib_arg, collation)
{
flags=(flags & ~ENUM_FLAG) | SET_FLAG;
}
......@@ -4833,8 +4832,6 @@ class Field_set final :public Field_enum {
{ return &type_handler_set; }
bool has_charset() const override { return true; }
Binlog_type_info binlog_type_info() const override;
private:
const String empty_set_string;
};
......
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