mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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.
This commit is contained in:
committed by
Robert Bindar
parent
f9ad8072cd
commit
6a282df0be
@@ -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_element(DYNAMIC_ARRAY *array, size_t array_index);
|
||||||
extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f);
|
extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f);
|
||||||
extern void freeze_size(DYNAMIC_ARRAY *array);
|
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_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 dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
|
||||||
#define push_dynamic(A,B) insert_dynamic((A),(B))
|
#define push_dynamic(A,B) insert_dynamic((A),(B))
|
||||||
|
@@ -375,29 +375,3 @@ void freeze_size(DYNAMIC_ARRAY *array)
|
|||||||
array->max_element= elements;
|
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
|
|
||||||
|
Reference in New Issue
Block a user