Skip to content

Commit 6a282df

Browse files
erichermanrobertbindar
authored andcommitted
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.
1 parent f9ad807 commit 6a282df

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

include/my_sys.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,6 @@ extern void delete_dynamic(DYNAMIC_ARRAY *array);
850850
extern void delete_dynamic_element(DYNAMIC_ARRAY *array, size_t array_index);
851851
extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f);
852852
extern void freeze_size(DYNAMIC_ARRAY *array);
853-
extern int get_index_dynamic(DYNAMIC_ARRAY *array, void *element);
854853
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
855854
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
856855
#define push_dynamic(A,B) insert_dynamic((A),(B))

mysys/array.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -375,29 +375,3 @@ void freeze_size(DYNAMIC_ARRAY *array)
375375
array->max_element= elements;
376376
}
377377
}
378-
379-
#ifdef NOT_USED
380-
/*
381-
Get the index of a dynamic element
382-
383-
SYNOPSIS
384-
get_index_dynamic()
385-
array Array
386-
element Whose element index
387-
388-
*/
389-
390-
int get_index_dynamic(DYNAMIC_ARRAY *array, void* element)
391-
{
392-
size_t ret;
393-
if (array->buffer > (uchar*) element)
394-
return -1;
395-
396-
ret= ((uchar*) element - array->buffer) / array->size_of_element;
397-
if (ret > array->elements)
398-
return -1;
399-
400-
return ret;
401-
402-
}
403-
#endif

0 commit comments

Comments
 (0)