1. 09 Dec, 2020 1 commit
    • alloc: set up an allocator that fails before library init · 08f28ff5
      We require the library to be initialized with git_libgit2_init before it
      is functional.  However, if a user tries to uses the library without
      doing so - as they might when getting started with the library for the
      first time - we will likely crash.
      
      This commit introduces some guard rails - now instead of having _no_
      allocator by default, we'll have an allocator that always fails, and
      never tries to set an error message (since the thread-local state is
      set up by git_libgit2_init).  We've modified the error retrieval
      function to (try to) ensure that the library has been initialized before
      getting the thread-local error message.
      
      (Unfortunately, we cannot determine if the thread local storage has
      actually been configured, this does require initialization by
      git_libgit2_init.  But a naive attempt should be good enough for most
      cases.)
      Edward Thomson committed