1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

perfschema - various collateral cleanups and small changes

This commit is contained in:
Sergei Golubchik
2020-02-14 16:42:23 +01:00
parent 0ea717f51a
commit 2ac3121af2
25 changed files with 66 additions and 70 deletions

View File

@ -170,6 +170,11 @@ public:
return ((const Elem*)array.buffer) + array.elements - 1;
}
const Elem *end() const
{
return back() + 1;
}
/// @returns pointer to n-th element
Elem *get_pos(size_t idx)
{
@ -182,7 +187,6 @@ public:
return ((const Elem*)array.buffer) + idx;
}
/**
@retval false ok
@retval true OOM, @c my_error() has been called.
@ -240,10 +244,16 @@ public:
freeze_size(&array);
}
bool reserve(size_t new_size)
{
return allocate_dynamic(&array, (uint)new_size);
}
bool resize(size_t new_size, Elem default_val)
{
size_t old_size= elements();
if (unlikely(allocate_dynamic(&array, (uint)new_size)))
if (reserve(new_size))
return true;
if (new_size > old_size)