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

@@ -16,7 +16,7 @@
#include "heapdef.h"
static int keys_compare(heap_rb_param *param, uchar *key1, uchar *key2);
static int keys_compare(void *heap_rb, const void *key1, const void *key2);
static void init_block(HP_BLOCK *block,uint reclength,ulong min_records,
ulong max_records);
@@ -190,7 +190,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
keyseg++;
init_tree(&keyinfo->rb_tree, 0, 0, sizeof(uchar*),
(qsort_cmp2)keys_compare, NULL, NULL,
keys_compare, NULL, NULL,
MYF((create_info->internal_table ? MY_THREAD_SPECIFIC : 0) |
MY_TREE_WITH_DELETE));
keyinfo->delete_key= hp_rb_delete_key;
@@ -255,11 +255,15 @@ err:
} /* heap_create */
static int keys_compare(heap_rb_param *param, uchar *key1, uchar *key2)
static int keys_compare(void *heap_rb_, const void *key1_,
const void *key2_)
{
heap_rb_param *heap_rb= heap_rb_;
const uchar *key1= key1_;
const uchar *key2= key2_;
uint not_used[2];
return ha_key_cmp(param->keyseg, key1, key2, param->key_length,
param->search_flag, not_used);
return ha_key_cmp(heap_rb->keyseg, key1, key2, heap_rb->key_length,
heap_rb->search_flag, not_used);
}
static void init_block(HP_BLOCK *block, uint reclength, ulong min_records,