summaryrefslogtreecommitdiff
path: root/include/git2/sys/alloc.h
Commit message (Collapse)AuthorAgeFilesLines
* docs: More of itEtienne Samson2019-06-261-9/+9
|
* Introduce GIT_CALLBACK macro to enforce cdeclEdward Thomson2019-01-171-9/+9
| | | | | | | | | Since we now always build the library with cdecl calling conventions, our callbacks should be decorated as such so that users will not be able to provide callbacks defined with other calling conventions. The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as appropriate.
* settings: allow swapping out memory allocatorPatrick Steinhardt2018-06-071-0/+24
| | | | | | | Tie in the newly created infrastructure for swapping out memory allocators into our settings code. A user can now simply use the new option "GIT_OPT_SET_ALLOCATOR" with `git_libgit2_opts`, passing in an already initialized allocator structure as vararg.
* alloc: make memory allocators use function pointersPatrick Steinhardt2018-06-071-0/+77
Currently, our memory allocators are being redirected to the correct implementation at compile time by simply using macros. In order to make them swappable at runtime, this commit reshuffles that by instead making use of a global "git_allocator" structure, whose pointers are set up to reference the allocator functions. Like this, it becomes easy to swap out allocators by simply setting these function pointers. In order to initialize a "git_allocator", our provided allocators "stdalloc" and "crtdbg" both provide an init function. This is being called to initialize a passed in allocator struct and set up its members correctly. No support is yet included to enable users of libgit2 to switch out the memory allocator at a global level.