diff options
author | Eric Herman <eric@freesa.org> | 2021-11-05 19:03:38 +0100 |
---|---|---|
committer | Robert Bindar <robert@mariadb.org> | 2021-11-24 16:39:38 +0200 |
commit | 6a282df0bee033266942fb891ded629c05db44b5 (patch) | |
tree | 9f09cda2737f88f21c26ebe07271e248a5c41061 | |
parent | f9ad8072cdb6376a3cf5384c76a85beb905f5dd8 (diff) | |
download | mariadb-git-bb-10.8-robert.tar.gz |
Remove DYNAMIC_ARRAY get_index_dynamic()bb-10.8-robert
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.
-rw-r--r-- | include/my_sys.h | 1 | ||||
-rw-r--r-- | mysys/array.c | 26 |
2 files changed, 0 insertions, 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 |