summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-02-21 12:27:42 +0100
committerPatrick Steinhardt <ps@pks.im>2019-02-21 13:23:54 +0100
commit48727e5d3bc0922a2073b717a6ee449e9bb0ddd7 (patch)
tree03673aa6ffa59ff4b8cf9dee8c4dd6d216af8def /src/alloc.c
parentb63396b75fe26afa3b27259c0d13dd7bc13b53ba (diff)
downloadlibgit2-48727e5d3bc0922a2073b717a6ee449e9bb0ddd7.tar.gz
allocators: extract crtdbg allocator into its own file
The Windows-specific crtdbg allocator is currently mixed into the crtdbg stacktracing compilation unit, making it harder to find than necessary. Extract it and move it into the new "allocators/" subdirectory to improve discoverability. This change means that the crtdbg compilation unit is now compiled unconditionally, whereas it has previously only been compiled on Windows platforms. Thus we now have additional guards around the code so that it will only be compiled if GIT_MSVC_CRTDBG is defined. This also allows us to move over the fallback-implementation of `git_win32_crtdbg_init_allocator` into the same compilation unit.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 5ff41517b..51c4d8029 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -7,11 +7,8 @@
#include "alloc.h"
-#if defined(GIT_MSVC_CRTDBG)
-# include "win32/w32_crtdbg_stacktrace.h"
-#else
-# include "allocators/stdalloc.h"
-#endif
+#include "allocators/stdalloc.h"
+#include "allocators/win32_crtdbg.h"
git_allocator git__allocator;
@@ -44,12 +41,3 @@ int git_allocator_setup(git_allocator *allocator)
memcpy(&git__allocator, allocator, sizeof(*allocator));
return 0;
}
-
-#if !defined(GIT_MSVC_CRTDBG)
-int git_win32_crtdbg_init_allocator(git_allocator *allocator)
-{
- GIT_UNUSED(allocator);
- git_error_set(GIT_EINVALID, "crtdbg memory allocator not available");
- return -1;
-}
-#endif