MCPcopy Create free account
hub / github.com/MariaDB/server / shrink

Method shrink

sql/sql_string.cc:1297–1307  ·  view source on GitHub ↗

Shrink the buffer, but only if it is allocated on the heap.

Source from the content-addressed store, hash-verified

1295
1296// Shrink the buffer, but only if it is allocated on the heap.
1297void Binary_string::shrink(size_t arg_length)
1298{
1299 if (is_alloced() && ALIGN_SIZE(arg_length + 1) < Alloced_length)
1300 {
1301 /* my_realloc() can't fail as new buffer is less than the original one */
1302 Ptr= (char*) my_realloc(STRING_PSI_MEMORY_KEY, Ptr, arg_length,
1303 MYF(thread_specific ?
1304 MY_THREAD_SPECIFIC : 0));
1305 Alloced_length= (uint32) arg_length;
1306 }
1307}

Callers 3

element_by_keyMethod · 0.45
sql_parse.ccFile · 0.45
alloc_queryFunction · 0.45

Calls 1

my_reallocFunction · 0.85

Tested by

no test coverage detected