diff options
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r-- | sql/sql_string.h | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h index eb69d21eaeb..4eeac0a8a82 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -30,6 +30,13 @@ #include "sql_list.h" class String; +#ifdef MYSQL_SERVER +extern PSI_memory_key key_memory_String_value; +#define STRING_PSI_MEMORY_KEY key_memory_String_value +#else +#define STRING_PSI_MEMORY_KEY PSI_NOT_INSTRUMENTED +#endif + typedef struct st_io_cache IO_CACHE; typedef struct st_mem_root MEM_ROOT; @@ -659,28 +666,8 @@ public: return realloc_with_extra(arg_length); } // Shrink the buffer, but only if it is allocated on the heap. - inline void shrink(size_t arg_length) - { - if (!is_alloced()) - return; - if (ALIGN_SIZE(arg_length+1) < Alloced_length) - { - char *new_ptr; - if (unlikely(!(new_ptr=(char*) - my_realloc(Ptr, - arg_length,MYF((thread_specific ? - MY_THREAD_SPECIFIC : 0)))))) - { - Alloced_length= 0; - real_alloc(arg_length); - } - else - { - Ptr= new_ptr; - Alloced_length= (uint32) arg_length; - } - } - } + void shrink(size_t arg_length); + void move(Binary_string &s) { set_alloced(s.Ptr, s.str_length, s.Alloced_length); |