diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-02-14 16:42:23 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-03-10 19:24:22 +0100 |
commit | 2ac3121af2767186c489054db5d4871d04b8eef4 (patch) | |
tree | 39de7dcc95c29fbd3d1ce3167262c61404e37743 /sql/sql_array.h | |
parent | 0ea717f51a152afdb3791195c4a25ee0baa2faac (diff) | |
download | mariadb-git-2ac3121af2767186c489054db5d4871d04b8eef4.tar.gz |
perfschema - various collateral cleanups and small changes
Diffstat (limited to 'sql/sql_array.h')
-rw-r--r-- | sql/sql_array.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/sql_array.h b/sql/sql_array.h index 44dde114d62..70aeaabc8ec 100644 --- a/sql/sql_array.h +++ b/sql/sql_array.h @@ -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) |