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:
@ -100,7 +100,7 @@ static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,
|
||||
uint tables, COND *conds,
|
||||
table_map table_map, SELECT_LEX *select_lex,
|
||||
SARGABLE_PARAM **sargables);
|
||||
static int sort_keyuse(KEYUSE *a,KEYUSE *b);
|
||||
static int sort_keyuse(const void *a, const void *b);
|
||||
static bool are_tables_local(JOIN_TAB *jtab, table_map used_tables);
|
||||
static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
|
||||
bool allow_full_scan, table_map used_tables);
|
||||
@ -119,9 +119,9 @@ static bool best_extension_by_limited_search(JOIN *join,
|
||||
uint use_cond_selectivity);
|
||||
static uint determine_search_depth(JOIN* join);
|
||||
C_MODE_START
|
||||
static int join_tab_cmp(const void *dummy, const void* ptr1, const void* ptr2);
|
||||
static int join_tab_cmp_straight(const void *dummy, const void* ptr1, const void* ptr2);
|
||||
static int join_tab_cmp_embedded_first(const void *emb, const void* ptr1, const void *ptr2);
|
||||
static int join_tab_cmp(void *dummy, const void* ptr1, const void* ptr2);
|
||||
static int join_tab_cmp_straight(void *dummy, const void* ptr1, const void* ptr2);
|
||||
static int join_tab_cmp_embedded_first(void *emb, const void* ptr1, const void *ptr2);
|
||||
C_MODE_END
|
||||
static uint cache_record_length(JOIN *join,uint index);
|
||||
static store_key *get_store_key(THD *thd,
|
||||
@ -6838,8 +6838,10 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
|
||||
|
||||
|
||||
static int
|
||||
sort_keyuse(KEYUSE *a,KEYUSE *b)
|
||||
sort_keyuse(const void *a_, const void *b_)
|
||||
{
|
||||
const KEYUSE *a= static_cast<const KEYUSE *>(a_);
|
||||
const KEYUSE *b= static_cast<const KEYUSE *>(b_);
|
||||
int res;
|
||||
if (a->table->tablenr != b->table->tablenr)
|
||||
return (int) (a->table->tablenr - b->table->tablenr);
|
||||
@ -8650,7 +8652,7 @@ choose_plan(JOIN *join, table_map join_tables)
|
||||
|
||||
join->cur_embedding_map= 0;
|
||||
reset_nj_counters(join, join->join_list);
|
||||
qsort2_cmp jtab_sort_func;
|
||||
qsort_cmp2 jtab_sort_func;
|
||||
|
||||
if (join->emb_sjm_nest)
|
||||
{
|
||||
@ -8734,7 +8736,7 @@ choose_plan(JOIN *join, table_map join_tables)
|
||||
1 - jt1 > jt2
|
||||
*/
|
||||
|
||||
static int compare_embedding_subqueries(JOIN_TAB *jt1, JOIN_TAB *jt2)
|
||||
static int compare_embedding_subqueries(const JOIN_TAB *jt1, const JOIN_TAB *jt2)
|
||||
{
|
||||
/* Determine if the first table is originally from a subquery */
|
||||
TABLE_LIST *tbl1= jt1->table->pos_in_table_list;
|
||||
@ -8809,10 +8811,10 @@ static int compare_embedding_subqueries(JOIN_TAB *jt1, JOIN_TAB *jt2)
|
||||
*/
|
||||
|
||||
static int
|
||||
join_tab_cmp(const void *dummy, const void* ptr1, const void* ptr2)
|
||||
join_tab_cmp(void *, const void* ptr1, const void* ptr2)
|
||||
{
|
||||
JOIN_TAB *jt1= *(JOIN_TAB**) ptr1;
|
||||
JOIN_TAB *jt2= *(JOIN_TAB**) ptr2;
|
||||
auto jt1= *(static_cast<const JOIN_TAB *const *>(ptr1));
|
||||
auto jt2= *(static_cast<const JOIN_TAB *const *>(ptr2));
|
||||
int cmp;
|
||||
|
||||
if ((cmp= compare_embedding_subqueries(jt1, jt2)) != 0)
|
||||
@ -8839,10 +8841,10 @@ join_tab_cmp(const void *dummy, const void* ptr1, const void* ptr2)
|
||||
*/
|
||||
|
||||
static int
|
||||
join_tab_cmp_straight(const void *dummy, const void* ptr1, const void* ptr2)
|
||||
join_tab_cmp_straight(void *, const void* ptr1, const void* ptr2)
|
||||
{
|
||||
JOIN_TAB *jt1= *(JOIN_TAB**) ptr1;
|
||||
JOIN_TAB *jt2= *(JOIN_TAB**) ptr2;
|
||||
auto jt1= *(static_cast<const JOIN_TAB *const *>(ptr1));
|
||||
auto jt2= *(static_cast<const JOIN_TAB *const *>(ptr2));
|
||||
|
||||
/*
|
||||
We don't do subquery flattening if the parent or child select has
|
||||
@ -8870,11 +8872,11 @@ join_tab_cmp_straight(const void *dummy, const void* ptr1, const void* ptr2)
|
||||
*/
|
||||
|
||||
static int
|
||||
join_tab_cmp_embedded_first(const void *emb, const void* ptr1, const void* ptr2)
|
||||
join_tab_cmp_embedded_first(void *emb, const void* ptr1, const void* ptr2)
|
||||
{
|
||||
const TABLE_LIST *emb_nest= (TABLE_LIST*) emb;
|
||||
JOIN_TAB *jt1= *(JOIN_TAB**) ptr1;
|
||||
JOIN_TAB *jt2= *(JOIN_TAB**) ptr2;
|
||||
TABLE_LIST *emb_nest= static_cast<TABLE_LIST *>(emb);
|
||||
auto jt1= *(static_cast<const JOIN_TAB *const *>(ptr1));
|
||||
auto jt2= *(static_cast<const JOIN_TAB *const *>(ptr2));
|
||||
|
||||
if (jt1->emb_sj_nest == emb_nest && jt2->emb_sj_nest != emb_nest)
|
||||
return -1;
|
||||
@ -25079,8 +25081,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
|
||||
(*field_length++)= (*ptr)->sort_length();
|
||||
|
||||
if (my_hash_init(key_memory_hash_index_key_buffer, &hash, &my_charset_bin,
|
||||
(uint) file->stats.records, 0, key_length,
|
||||
(my_hash_get_key) 0, 0, 0))
|
||||
(uint) file->stats.records, 0, key_length, 0, 0, 0))
|
||||
{
|
||||
my_free(key_buffer);
|
||||
DBUG_RETURN(1);
|
||||
|
Reference in New Issue
Block a user