diff options
author | andrey@lmy004. <> | 2005-12-02 13:07:02 +0100 |
---|---|---|
committer | andrey@lmy004. <> | 2005-12-02 13:07:02 +0100 |
commit | a370c2d90743607c66c4ec9bd141169a63004004 (patch) | |
tree | 7152e34323e50a0845f559f1477316b2b57c7737 /mysys/array.c | |
parent | a27a1f0ad34a23f002c39a0d13f3bb06d3683fc8 (diff) | |
download | mariadb-git-a370c2d90743607c66c4ec9bd141169a63004004.tar.gz |
WL1034 update for latest 5.1 sources
Diffstat (limited to 'mysys/array.c')
-rw-r--r-- | mysys/array.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysys/array.c b/mysys/array.c index 6d00585f24d..a50d8b78178 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -278,3 +278,28 @@ void freeze_size(DYNAMIC_ARRAY *array) array->max_element=elements; } } + + +/* + Get the index of a dynamic element + + SYNOPSIS + get_index_dynamic() + array Array + element Whose element index + +*/ + +int get_index_dynamic(DYNAMIC_ARRAY *array, gptr element) +{ + uint ret; + if (array->buffer > element) + return -1; + + ret= (element - array->buffer) / array->size_of_element; + if (ret > array->elements) + return -1; + + return ret; + +} |