cleanup: thd->alloc<>() and thd->calloc<>()

create templates

  thd->alloc<X>(n) to use instead of (X*)thd->alloc(sizeof(X)*n)

and the same for thd->calloc(). By the default the type is char,
so old usage of thd->alloc(size) works too.
This commit is contained in:
Sergei Golubchik 2024-06-01 16:15:53 +02:00
commit 44c6328cbb
63 changed files with 262 additions and 362 deletions

View file

@ -544,7 +544,7 @@ Event_parse_data::init_definer(THD *thd)
/* + 1 for @ */
DBUG_PRINT("info",("init definer as whole"));
definer.length= definer_user_len + definer_host_len + 1;
definer.str= tmp= (char*) thd->alloc(definer.length + 1);
definer.str= tmp= thd->alloc(definer.length + 1);
DBUG_PRINT("info",("copy the user"));
strmake(tmp, definer_user, definer_user_len);