From 6a282df0bee033266942fb891ded629c05db44b5 Mon Sep 17 00:00:00 2001 From: Eric Herman Date: Fri, 5 Nov 2021 19:03:38 +0100 Subject: [PATCH] Remove DYNAMIC_ARRAY get_index_dynamic() The DYNAMIC_ARRAY copies values in and copies values out. Without a comparitor function, get_index_dynamic() does not make sense. This function is not used. If we have a need for a function like it in the future, I propose we write a new one with unit tests showing how it is used and demostrating that it behaves as expected. --- include/my_sys.h | 1 - mysys/array.c | 26 -------------------------- 2 files changed, 27 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index f63fe38aab8..c6526e581cd 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -850,7 +850,6 @@ extern void delete_dynamic(DYNAMIC_ARRAY *array); extern void delete_dynamic_element(DYNAMIC_ARRAY *array, size_t array_index); extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f); extern void freeze_size(DYNAMIC_ARRAY *array); -extern int get_index_dynamic(DYNAMIC_ARRAY *array, void *element); #define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element) #define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index)) #define push_dynamic(A,B) insert_dynamic((A),(B)) diff --git a/mysys/array.c b/mysys/array.c index c9bf609b6d4..aa2f444653f 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -375,29 +375,3 @@ void freeze_size(DYNAMIC_ARRAY *array) array->max_element= elements; } } - -#ifdef NOT_USED -/* - Get the index of a dynamic element - - SYNOPSIS - get_index_dynamic() - array Array - element Whose element index - -*/ - -int get_index_dynamic(DYNAMIC_ARRAY *array, void* element) -{ - size_t ret; - if (array->buffer > (uchar*) element) - return -1; - - ret= ((uchar*) element - array->buffer) / array->size_of_element; - if (ret > array->elements) - return -1; - - return ret; - -} -#endif