diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-01-16 12:18:21 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-01-16 12:18:21 +0200 |
commit | 7b44c31be8d45bbb7f903ed8d3e426516cfaecfb (patch) | |
tree | 7973e0fa171796905bf28a5f906033fe93714a2f /mysys | |
parent | 5ac71d4464f556f26c81172cb0fef679389beda8 (diff) | |
parent | 7e3f3deb41a875778a540718abd8f90278e4cb67 (diff) | |
download | mariadb-git-7b44c31be8d45bbb7f903ed8d3e426516cfaecfb.tar.gz |
Merge remote-tracking branch 'origin/10.1' into 10.1bb-10.1-vicentiu-galera
Extra merge due to more extra commits during merge process
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_malloc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index e533230106e..dc02d3896bd 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -48,7 +48,6 @@ static inline size_t malloc_size_and_flag(void *p, my_bool *is_thread_specific) #define MALLOC_FIX_POINTER_FOR_FREE(p) (((char*) (p)) - MALLOC_PREFIX_SIZE) #endif /* SAFEMALLOC */ -static MALLOC_SIZE_CB malloc_size_cb_func= NULL; /** Inform application that memory usage has changed @@ -59,17 +58,19 @@ static MALLOC_SIZE_CB malloc_size_cb_func= NULL; The type os size is long long, to be able to handle negative numbers to decrement the memory usage + + @return 0 - ok + 1 - failure, abort the allocation */ +static void dummy(long long size __attribute__((unused)), + my_bool is_thread_specific __attribute__((unused))) +{} -static void update_malloc_size(long long size, my_bool is_thread_specific) -{ - if (malloc_size_cb_func) - malloc_size_cb_func(size, is_thread_specific); -} +static MALLOC_SIZE_CB update_malloc_size= dummy; void set_malloc_size_cb(MALLOC_SIZE_CB func) { - malloc_size_cb_func= func; + update_malloc_size= func ? func : dummy; } |