diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-10-29 15:08:44 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-10-29 15:08:44 +0100 |
commit | 0fdb3bcfdbfa5d7cad28adc1c0f7c0958cdab2e0 (patch) | |
tree | 7d6a1d36b975e2b1bb8d9ffd3b7511ec0694349e /mysys/array.c | |
parent | 7dc48ae327ad27205dffe0cec16b445d01529f84 (diff) | |
parent | fef416699009b78366d9eec937c01822b531f518 (diff) | |
download | mariadb-git-0fdb3bcfdbfa5d7cad28adc1c0f7c0958cdab2e0.tar.gz |
10.0-base merge (roles)
Diffstat (limited to 'mysys/array.c')
-rw-r--r-- | mysys/array.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysys/array.c b/mysys/array.c index cf377f77676..e92c5b45e67 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -321,7 +321,24 @@ void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx) (array->elements-idx)*array->size_of_element); } +/* + Wrapper around delete_dynamic, calling a FREE function on every + element, before releasing the memory + SYNOPSIS + delete_dynamic_with_callback() + array + f The function to be called on every element before + deleting the array; +*/ +void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f) { + uint i; + char *ptr= (char*) array->buffer; + for (i= 0; i < array->elements; i++, ptr+= array->size_of_element) { + f(ptr); + } + delete_dynamic(array); +} /* Free unused memory |