1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-34348: Consolidate cmp function declarations

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

The functions queue_compare, qsort2_cmp, and qsort_cmp2
all had similar interfaces, and were used interchangable
and unsafely cast to one another.

This patch consolidates the functions all into the
qsort_cmp2 interface.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
This commit is contained in:
Brandon Nesterenko
2024-10-26 08:17:03 -06:00
parent 3997d28f48
commit dbfee9fc2b
83 changed files with 678 additions and 524 deletions

View File

@@ -730,8 +730,8 @@ static int write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
if (!buffpek)
DBUG_RETURN(1); /* Out of memory */
my_qsort2((uchar*) sort_keys,(size_t) count, sizeof(uchar*),
(qsort2_cmp) info->key_cmp, info);
my_qsort2(sort_keys, count, sizeof(uchar *),
info->key_cmp, info);
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
DISK_BUFFER_SIZE, info->sort_info->param->myf_rw))
@@ -776,8 +776,8 @@ static int write_keys_varlen(MI_SORT_PARAM *info,
if (!buffpek)
DBUG_RETURN(1); /* Out of memory */
my_qsort2((uchar*) sort_keys, (size_t) count, sizeof(uchar*),
(qsort2_cmp) info->key_cmp, info);
my_qsort2(sort_keys, count, sizeof(uchar *),
info->key_cmp, info);
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
DISK_BUFFER_SIZE, info->sort_info->param->myf_rw))
@@ -818,8 +818,8 @@ static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
{
DBUG_ENTER("write_index");
my_qsort2((uchar*) sort_keys,(size_t) count,sizeof(uchar*),
(qsort2_cmp) info->key_cmp,info);
my_qsort2(sort_keys, count, sizeof(uchar *),
info->key_cmp, info);
while (count--)
{
if ((*info->key_write)(info,*sort_keys++))
@@ -1004,7 +1004,7 @@ merge_buffers(MI_SORT_PARAM *info, ha_keys keys, IO_CACHE *from_file,
sort_length=info->key_length;
if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
(int (*)(void*, uchar *,uchar*)) info->key_cmp,
info->key_cmp,
(void*) info, 0, 0))
DBUG_RETURN(1); /* purecov: inspected */