mirror of
https://github.com/MariaDB/server.git
synced 2025-04-23 07:05:53 +03:00
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.
This commit is contained in:
parent
3648b333c7
commit
59b51e6aa7
10
sql/field.cc
10
sql/field.cc
@ -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 @@ public:
|
||||
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 @@ public:
|
||||
{ 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;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user