MDEV-34348: my_hash_get_key fixes

Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

Change the type of my_hash_get_key to:
 1) Return const
 2) Change the context parameter to be const void*

Also fix casting in hash adjacent areas.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
This commit is contained in:
Brandon Nesterenko 2024-10-26 11:34:26 -06:00
commit 840fe316d4
67 changed files with 604 additions and 617 deletions

View file

@ -597,25 +597,22 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation)
}
#endif
static uchar *mrn_open_tables_get_key(const uchar *record,
size_t *length,
my_bool not_used __attribute__ ((unused)))
static const uchar *mrn_open_tables_get_key(const void *record, size_t *length,
my_bool)
{
MRN_DBUG_ENTER_FUNCTION();
MRN_SHARE *share = reinterpret_cast<MRN_SHARE *>(const_cast<uchar *>(record));
auto share = static_cast<const MRN_SHARE *>(record);
*length = share->table_name_length;
DBUG_RETURN(reinterpret_cast<uchar *>(share->table_name));
DBUG_RETURN(reinterpret_cast<const uchar *>(share->table_name));
}
static uchar *mrn_long_term_share_get_key(const uchar *record,
size_t *length,
my_bool not_used __attribute__ ((unused)))
static const uchar *mrn_long_term_share_get_key(const void *record,
size_t *length, my_bool)
{
MRN_DBUG_ENTER_FUNCTION();
MRN_LONG_TERM_SHARE *long_term_share =
reinterpret_cast<MRN_LONG_TERM_SHARE *>(const_cast<uchar *>(record));
auto long_term_share= static_cast<const MRN_LONG_TERM_SHARE *>(record);
*length = long_term_share->table_name_length;
DBUG_RETURN(reinterpret_cast<uchar *>(long_term_share->table_name));
DBUG_RETURN(reinterpret_cast<const uchar *>(long_term_share->table_name));
}
/* status */
@ -693,13 +690,12 @@ static grn_logger mrn_logger = {
NULL
};
static uchar *mrn_allocated_thds_get_key(const uchar *record,
size_t *length,
my_bool not_used __attribute__ ((unused)))
static const uchar *mrn_allocated_thds_get_key(const void *record,
size_t *length, my_bool)
{
MRN_DBUG_ENTER_FUNCTION();
*length = sizeof(THD *);
DBUG_RETURN(const_cast<uchar *>(record));
DBUG_RETURN(static_cast<const uchar *>(record));
}
/* system functions */