1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +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

@ -1646,8 +1646,8 @@ public:
table_field= field;
tree_key_length= field->pack_length();
tree= new Unique((qsort_cmp2) simple_str_key_cmp, (void*) field,
tree_key_length, max_heap_table_size, 1);
tree= new Unique(simple_str_key_cmp, field, tree_key_length,
max_heap_table_size, 1);
}
virtual ~Count_distinct_field()
@ -1732,13 +1732,13 @@ public:
static
int simple_ulonglong_key_cmp(void* arg, uchar* key1, uchar* key2)
int simple_ulonglong_key_cmp(void*, const void* key1, const void* key2)
{
ulonglong *val1= (ulonglong *) key1;
ulonglong *val2= (ulonglong *) key2;
const ulonglong *val1= static_cast<const ulonglong *>(key1);
const ulonglong *val2= static_cast<const ulonglong *>(key2);
return *val1 > *val2 ? 1 : *val1 == *val2 ? 0 : -1;
}
/*
The class Count_distinct_field_bit is derived from the class
@ -1755,8 +1755,7 @@ public:
table_field= field;
tree_key_length= sizeof(ulonglong);
tree= new Unique((qsort_cmp2) simple_ulonglong_key_cmp,
(void*) &tree_key_length,
tree= new Unique(simple_ulonglong_key_cmp, &tree_key_length,
tree_key_length, max_heap_table_size, 1);
}