commit 26045ea1708c6551142fa4c155e708f9985b0114 Author: Monty <monty@mariadb.org> Date: Wed Aug 12 20:29:55 2020 +0300
Reduce usage of strlen()
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 3c43595533f..d949687283f 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -407,13 +407,13 @@ static handler *maria_create_handler(handlerton *hton, }
-static void _ma_check_print(HA_CHECK *param, const char* msg_type, +static void _ma_check_print(HA_CHECK *param, const LEX_CSTRING *msg_type, const char *msgbuf)
I would also suggest passing LEX_CSTRING by value. Its size is not more than two pointers, so it can be passed by registers by most ABIs. Passing it by a pointer add a second dereference, which is costy
{ - if (msg_type == MA_CHECK_INFO) + if (msg_type == &MA_CHECK_INFO) sql_print_information("%s.%s: %s", param->db_name, param->table_name, msgbuf); - else if (msg_type == MA_CHECK_WARNING) + else if (msg_type == &MA_CHECK_WARNING) sql_print_warning("%s.%s: %s", param->db_name, param->table_name, msgbuf); else @@ -423,7 +423,7 @@ static void _ma_check_print(HA_CHECK *param, const char* msg_type,
// collect errors printed by maria_check routines
-static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type, +static void _ma_check_print_msg(HA_CHECK *param, const LEX_CSTRING *msg_type, const char *fmt, va_list args) { THD *thd= (THD *) param->thd;
-- Yours truly, Nikita Malyavin