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:
@ -38,32 +38,40 @@
|
||||
#define MAX_TREEMEM 8192
|
||||
#define MAX_TREE_ELEMENTS 256
|
||||
|
||||
int sortcmp2(void* cmp_arg __attribute__((unused)),
|
||||
const String *a,const String *b)
|
||||
int sortcmp2(void *, const void *a_, const void *b_)
|
||||
{
|
||||
const String *a= static_cast<const String*>(a_);
|
||||
const String *b= static_cast<const String*>(b_);
|
||||
return sortcmp(a,b,a->charset());
|
||||
}
|
||||
|
||||
int compare_double2(void* cmp_arg __attribute__((unused)),
|
||||
const double *s, const double *t)
|
||||
int compare_double2(void *, const void *s_, const void *t_)
|
||||
{
|
||||
const double *s= static_cast<const double*>(s_);
|
||||
const double *t= static_cast<const double*>(t_);
|
||||
|
||||
return compare_double(s,t);
|
||||
}
|
||||
|
||||
int compare_longlong2(void* cmp_arg __attribute__((unused)),
|
||||
const longlong *s, const longlong *t)
|
||||
int compare_longlong2(void *, const void *s_, const void *t_)
|
||||
{
|
||||
const longlong *s= static_cast<const longlong*>(s_);
|
||||
const longlong *t= static_cast<const longlong*>(t_);
|
||||
return compare_longlong(s,t);
|
||||
}
|
||||
|
||||
int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
|
||||
const ulonglong *s, const ulonglong *t)
|
||||
int compare_ulonglong2(void *, const void *s_, const void *t_)
|
||||
{
|
||||
const ulonglong *s= static_cast<const ulonglong*>(s_);
|
||||
const ulonglong *t= static_cast<const ulonglong*>(t_);
|
||||
return compare_ulonglong(s,t);
|
||||
}
|
||||
|
||||
int compare_decimal2(int* len, const char *s, const char *t)
|
||||
int compare_decimal2(void *_len, const void *s_, const void *t_)
|
||||
{
|
||||
int *len= static_cast<int *>(_len);
|
||||
const char *s= static_cast<const char *>(s_);
|
||||
const char *t= static_cast<const char *>(t_);
|
||||
return memcmp(s, t, *len);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user