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

@@ -172,12 +172,12 @@ Rowid_filter_container *Range_rowid_filter_cost_info::create_container()
}
static
int compare_range_rowid_filter_cost_info_by_a(
Range_rowid_filter_cost_info **filter_ptr_1,
Range_rowid_filter_cost_info **filter_ptr_2)
static int compare_range_rowid_filter_cost_info_by_a(const void *p1_,
const void *p2_)
{
double diff= (*filter_ptr_2)->get_a() - (*filter_ptr_1)->get_a();
auto p1= static_cast<const Range_rowid_filter_cost_info *const *>(p1_);
auto p2= static_cast<const Range_rowid_filter_cost_info *const *>(p2_);
double diff= (*p2)->get_a() - (*p1)->get_a();
return (diff < 0 ? -1 : (diff > 0 ? 1 : 0));
}