summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-06-15 12:07:44 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2020-06-15 13:26:50 +0200
commitdeb8d2d127ceeb2faaa4a11c43abf1ef74bfe59e (patch)
tree4286159dc0f3e65d8020554adbf526a3dccb3ac3
parentea8b02446f991ab17df6b3197e05e53cc1949066 (diff)
downloadmariadb-git-bb-10.5-wlad-constexpr.tar.gz
MDEV-22841 - try to please gcc 4.8bb-10.5-wlad-constexpr
-rw-r--r--storage/innobase/include/ut0new.h5
-rw-r--r--storage/innobase/ut/ut0new.cc4
2 files changed, 5 insertions, 4 deletions
diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h
index d34954a503c..5137c8f3ae1 100644
--- a/storage/innobase/include/ut0new.h
+++ b/storage/innobase/include/ut0new.h
@@ -895,12 +895,13 @@ constexpr const char* const auto_event_names[] =
"ut0pool",
"ut0rbt",
"ut0wqueue",
- "xtrabackup"
+ "xtrabackup",
+ nullptr
};
constexpr uint32_t cexpr_lookup_auto_event_name(const char* name, uint32_t idx = 0)
{
- return idx == UT_ARR_SIZE(auto_event_names) ? INVALID_AUTOEVENT_IDX :
+ return !auto_event_names[idx] ? INVALID_AUTOEVENT_IDX :
cexpr_strequal_ignore_dot(name, auto_event_names[idx]) ? idx :
cexpr_lookup_auto_event_name(name, idx + 1);
}
diff --git a/storage/innobase/ut/ut0new.cc b/storage/innobase/ut/ut0new.cc
index 67671348a6e..834386e042e 100644
--- a/storage/innobase/ut/ut0new.cc
+++ b/storage/innobase/ut/ut0new.cc
@@ -71,14 +71,14 @@ static PSI_memory_info pfs_info[] = {
{&mem_key_std, "std", 0},
};
-static const int NKEYS = static_cast<int>UT_ARR_SIZE(auto_event_names);
+static const int NKEYS = static_cast<int>UT_ARR_SIZE(auto_event_names)-1;
static PSI_memory_key auto_event_keys[NKEYS];
/** Setup the internal objects needed for UT_NEW() to operate.
This must be called before the first call to UT_NEW(). */
void ut_new_boot()
{
- PSI_MEMORY_CALL(register_memory)("innodb", pfs_info, UT_ARR_SIZE(pfs_info));
+ PSI_MEMORY_CALL(register_memory)("innodb", pfs_info, static_cast<int>(UT_ARR_SIZE(pfs_info)));
static PSI_memory_info pfs_info_auto[NKEYS];
for (int i= 0; i < NKEYS; i++)
{