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:
@@ -131,8 +131,8 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees,
|
||||
uint trees,
|
||||
HUFF_COUNTS *huff_counts,
|
||||
uint fields);
|
||||
static int compare_tree(void* cmp_arg __attribute__((unused)),
|
||||
const uchar *s,const uchar *t);
|
||||
static int compare_tree(void *cmp_arg __attribute__((unused)),
|
||||
const void *s, const void *t);
|
||||
static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts);
|
||||
static void check_counts(HUFF_COUNTS *huff_counts,uint trees,
|
||||
my_off_t records);
|
||||
@@ -142,7 +142,7 @@ static int test_space_compress(HUFF_COUNTS *huff_counts,my_off_t records,
|
||||
enum en_fieldtype field_type);
|
||||
static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts,uint trees);
|
||||
static int make_huff_tree(HUFF_TREE *tree,HUFF_COUNTS *huff_counts);
|
||||
static int compare_huff_elements(void *not_used, uchar *a,uchar *b);
|
||||
static int compare_huff_elements(void *not_used, const void *a, const void *b);
|
||||
static int save_counts_in_queue(uchar *key,element_count count,
|
||||
HUFF_TREE *tree);
|
||||
static my_off_t calc_packed_length(HUFF_COUNTS *huff_counts,uint flag);
|
||||
@@ -176,7 +176,7 @@ static int mrg_rrnd(PACK_MRG_INFO *info,uchar *buf);
|
||||
static void mrg_reset(PACK_MRG_INFO *mrg);
|
||||
#if !defined(DBUG_OFF)
|
||||
static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count);
|
||||
static int fakecmp(my_off_t **count1, my_off_t **count2);
|
||||
static int fakecmp(const void *count1, const void *count2);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -822,8 +822,8 @@ static HUFF_COUNTS *init_huff_count(MI_INFO *info,my_off_t records)
|
||||
'tree_pos'. It's keys are implemented by pointers into 'tree_buff'.
|
||||
This is accomplished by '-1' as the element size.
|
||||
*/
|
||||
init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree, NULL,
|
||||
NULL, MYF(0));
|
||||
init_tree(&count[i].int_tree, 0, 0, -1, compare_tree, NULL, NULL,
|
||||
MYF(0));
|
||||
if (records && type != FIELD_BLOB && type != FIELD_VARCHAR)
|
||||
count[i].tree_pos=count[i].tree_buff =
|
||||
my_malloc(PSI_NOT_INSTRUMENTED, count[i].field_length > 1 ? tree_buff_length : 2,
|
||||
@@ -1182,10 +1182,11 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
|
||||
}
|
||||
|
||||
static int compare_huff_elements(void *not_used __attribute__((unused)),
|
||||
uchar *a, uchar *b)
|
||||
const void *a_, const void *b_)
|
||||
{
|
||||
return *((my_off_t*) a) < *((my_off_t*) b) ? -1 :
|
||||
(*((my_off_t*) a) == *((my_off_t*) b) ? 0 : 1);
|
||||
const my_off_t *a= a_;
|
||||
const my_off_t *b= b_;
|
||||
return *a < *b ? -1 : (*a == *b ? 0 : 1);
|
||||
}
|
||||
|
||||
/* Check each tree if we should use pre-space-compress, end-space-
|
||||
@@ -1694,9 +1695,11 @@ static int make_huff_tree(HUFF_TREE *huff_tree, HUFF_COUNTS *huff_counts)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int compare_tree(void* cmp_arg __attribute__((unused)),
|
||||
register const uchar *s, register const uchar *t)
|
||||
static int compare_tree(void *cmp_arg __attribute__((unused)), const void *s_,
|
||||
const void *t_)
|
||||
{
|
||||
const uchar *s= s_;
|
||||
const uchar *t= t_;
|
||||
uint length;
|
||||
for (length=global_count->field_length; length-- ;)
|
||||
if (*s++ != *t++)
|
||||
@@ -3227,8 +3230,10 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count)
|
||||
-1 count1 > count2
|
||||
*/
|
||||
|
||||
static int fakecmp(my_off_t **count1, my_off_t **count2)
|
||||
static int fakecmp(const void *count1_, const void *count2_)
|
||||
{
|
||||
const my_off_t *const *count1= count1_;
|
||||
const my_off_t *const *count2= count2_;
|
||||
return ((**count1 < **count2) ? 1 :
|
||||
(**count1 > **count2) ? -1 : 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user