aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-07 17:58:29 +0300
committerZyX <kp-pav@yandex.ru>2017-01-07 17:58:29 +0300
commit6f267b3968d54f8bcd41d584a71bef9020ff773e (patch)
tree9b40dbf2753839c2c054c14fa50e3b021a7946c9
parent35416e89bcef1de97881a14dc2d2408144bd8a7f (diff)
downloadrneovim-6f267b3968d54f8bcd41d584a71bef9020ff773e.tar.gz
rneovim-6f267b3968d54f8bcd41d584a71bef9020ff773e.tar.bz2
rneovim-6f267b3968d54f8bcd41d584a71bef9020ff773e.zip
memory: Document new additions to memory.h
-rw-r--r--src/nvim/memory.c1
-rw-r--r--src/nvim/memory.h17
2 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index a5045dfffc..92ead873ae 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -49,7 +49,6 @@ MemRealloc mem_realloc = &realloc;
#endif
#ifdef EXITFREE
-/// Indicates that free_all_mem function was or is running
bool entered_free_all_mem = false;
#endif
diff --git a/src/nvim/memory.h b/src/nvim/memory.h
index d82972cffc..f65947d449 100644
--- a/src/nvim/memory.h
+++ b/src/nvim/memory.h
@@ -5,17 +5,34 @@
#include <stddef.h> // for size_t
#include <time.h> // for time_t
+/// `malloc()` function signature
typedef void *(*MemMalloc)(size_t);
+
+/// `free()` function signature
typedef void (*MemFree)(void *);
+
+/// `calloc()` function signature
typedef void *(*MemCalloc)(size_t, size_t);
+
+/// `realloc()` function signature
typedef void *(*MemRealloc)(void *, size_t);
+#ifdef UNIT_TESTING
+/// When unit testing: pointer to the `malloc()` function, may be altered
extern MemMalloc mem_malloc;
+
+/// When unit testing: pointer to the `free()` function, may be altered
extern MemFree mem_free;
+
+/// When unit testing: pointer to the `calloc()` function, may be altered
extern MemCalloc mem_calloc;
+
+/// When unit testing: pointer to the `realloc()` function, may be altered
extern MemRealloc mem_realloc;
+#endif
#ifdef EXITFREE
+/// Indicates that free_all_mem function was or is running
extern bool entered_free_all_mem;
#endif