diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-15 17:09:20 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-15 17:23:08 +0300 |
commit | ff66d65a096ec02dda1ab449d84a40361551085c (patch) | |
tree | 62758be70a0df31bc0c376f948ef1dba3cc58b7b /sql/field.h | |
parent | 1cac6d48282459d8855c1cec1eeb4bc0e3db5f89 (diff) | |
download | mariadb-git-ff66d65a096ec02dda1ab449d84a40361551085c.tar.gz |
Amend af784385b4a2b286000fa2c658e34283fe7bba60: Avoid vtable overhead
When neither MSAN nor Valgrind are enabled, declare
Field::mark_unused_memory_as_defined() as an empty inline function,
instead of declaring it as a virtual function.
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/field.h b/sql/field.h index ea57a4f07cc..3007e666ba7 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1,7 +1,7 @@ #ifndef FIELD_INCLUDED #define FIELD_INCLUDED /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2017, MariaDB Corporation. + Copyright (c) 2008, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -850,13 +850,17 @@ public: enum_check_fields check_level); int store(const LEX_STRING *ls, CHARSET_INFO *cs) { return store(ls->str, (uint32) ls->length, cs); } - /* +#ifdef HAVE_valgrind_or_MSAN + /** Mark unused memory in the field as defined. Mainly used to ensure that if we write full field to disk (for example in Count_distinct_field::add(), we don't write unitalized data to disk which would confuse valgrind or MSAN. */ virtual void mark_unused_memory_as_defined() {} +#else + void mark_unused_memory_as_defined() {} +#endif virtual double val_real(void)=0; virtual longlong val_int(void)=0; @@ -3250,7 +3254,9 @@ public: int store(const char *to,uint length,CHARSET_INFO *charset); int store(longlong nr, bool unsigned_val); int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */ +#ifdef HAVE_valgrind_or_MSAN void mark_unused_memory_as_defined(); +#endif /* HAVE_valgrind_or_MSAN */ double val_real(void); longlong val_int(void); String *val_str(String*,String *); |