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

@@ -551,10 +551,10 @@ int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length)
@retval +1 first_rec is greater than second_rec
*/
int key_rec_cmp(void *key_p, uchar *first_rec, uchar *second_rec)
int key_rec_cmp(const KEY *const *key, const uchar *first_rec,
const uchar *second_rec)
{
KEY **key= (KEY**) key_p;
KEY *key_info= *(key++); // Start with first key
const KEY *key_info= *(key++); // Start with first key
uint key_parts, key_part_num;
KEY_PART_INFO *key_part= key_info->key_part;
uchar *rec0= key_part->field->ptr - key_part->offset;
@@ -642,10 +642,10 @@ next_loop:
@retval +1 key1 > key2
*/
int key_tuple_cmp(KEY_PART_INFO *part, uchar *key1, uchar *key2,
int key_tuple_cmp(KEY_PART_INFO *part, const uchar *key1, const uchar *key2,
uint tuple_length)
{
uchar *key1_end= key1 + tuple_length;
const uchar *key1_end= key1 + tuple_length;
int UNINIT_VAR(len);
int res;
for (;key1 < key1_end; key1 += len, key2 += len, part++)
@@ -672,7 +672,6 @@ int key_tuple_cmp(KEY_PART_INFO *part, uchar *key1, uchar *key2,
return 0;
}
/**
Get hash value for the key from a key buffer