summaryrefslogtreecommitdiff
path: root/storage/innobase/include/ut0vec.ic
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2013-03-26 00:03:13 +0200
committerMichael Widenius <monty@askmonty.org>2013-03-26 00:03:13 +0200
commit068c61978e3a81836d52b8caf11e044290159ad1 (patch)
tree2cbca861ab2cebe3bd99379ca9668bb483ca0d2a /storage/innobase/include/ut0vec.ic
parent35bc8f9f4353b64da215e52ff6f1612a8ce66f43 (diff)
downloadmariadb-git-068c61978e3a81836d52b8caf11e044290159ad1.tar.gz
Temporary commit of 10.0-merge
Diffstat (limited to 'storage/innobase/include/ut0vec.ic')
-rw-r--r--storage/innobase/include/ut0vec.ic13
1 files changed, 7 insertions, 6 deletions
diff --git a/storage/innobase/include/ut0vec.ic b/storage/innobase/include/ut0vec.ic
index 1255caee2d9..f41a85e1d1d 100644
--- a/storage/innobase/include/ut0vec.ic
+++ b/storage/innobase/include/ut0vec.ic
@@ -346,9 +346,10 @@ ib_vector_remove(
ib_vector_t* vec, /*!< in: vector */
const void* elem) /*!< in: value to remove */
{
- void* current;
+ void* current = NULL;
void* next;
ulint i;
+ ulint old_used_count = vec->used;
for (i = 0; i < vec->used; i++) {
current = ib_vector_get(vec, i);
@@ -359,14 +360,14 @@ ib_vector_remove(
}
next = ib_vector_get(vec, i + 1);
- memcpy(current, next, vec->sizeof_value
- * (vec->used - i - 1));
+ memmove(current, next, vec->sizeof_value
+ * (vec->used - i - 1));
+ --vec->used;
+ break;
}
}
- --vec->used;
-
- return(current);
+ return((old_used_count != vec->used) ? current : NULL);
}
/********************************************************************