summaryrefslogtreecommitdiff
path: root/storage/perfschema/unittest/stub_pfs_global.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/perfschema/unittest/stub_pfs_global.h')
-rw-r--r--storage/perfschema/unittest/stub_pfs_global.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h
index 8a1f9216ba2..23b731cb8b2 100644
--- a/storage/perfschema/unittest/stub_pfs_global.h
+++ b/storage/perfschema/unittest/stub_pfs_global.h
@@ -26,11 +26,13 @@
#include <string.h>
bool pfs_initialized= false;
+size_t pfs_allocated_memory_size= 0;
+size_t pfs_allocated_memory_count= 0;
bool stub_alloc_always_fails= true;
int stub_alloc_fails_after_count= 0;
-void *pfs_malloc(size_t size, myf)
+void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf)
{
/*
Catch non initialized sizing parameter in the unit tests.
@@ -49,19 +51,27 @@ void *pfs_malloc(size_t size, myf)
return ptr;
}
-void pfs_free(void *ptr)
+void pfs_free(PFS_builtin_memory_class *, size_t, void *ptr)
{
if (ptr != NULL)
free(ptr);
}
-void *pfs_malloc_array(size_t n, size_t size, myf flags)
+void *pfs_malloc_array(PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags)
{
size_t array_size= n * size;
/* Check for overflow before allocating. */
if (is_overflow(array_size, n, size))
return NULL;
- return pfs_malloc(array_size, flags);
+ return pfs_malloc(klass, array_size, flags);
+}
+
+void pfs_free_array(PFS_builtin_memory_class *klass, size_t n, size_t size, void *ptr)
+{
+ if (ptr == NULL)
+ return;
+ size_t array_size= n * size;
+ return pfs_free(klass, array_size, ptr);
}
bool is_overflow(size_t product, size_t n1, size_t n2)
@@ -76,3 +86,4 @@ void pfs_print_error(const char *format, ...)
{
}
+