1. 20 Mar, 2017 1 commit
    • map: remove `*map_free` macros · 94af9155
      The `map_free` functions were not implemented as functions but instead
      as macros which also set the map to NULL. While this is most certainly
      sensible in most cases, we should prefer the more obvious behavior,
      namingly leaving the map pointer intact.
      
      Furthermore, this macro has been refactored incorrectly during the
      map-refactorings: the two statements are not actually grouped together
      by a `do { ... } while (0)` block, as it is required for macros to
      match the behavior of functions more closely. This has led to at least
      one subtle nesting error in `pack-objects.c`. The following code block
      
      ```
          if (pb->object_ix)
              git_oidmap_free(pb->object_ix);
      ```
      
      would be expanded to
      
      ```
          if (pb->object_ix)
              git_oidmap__free(pb->object_ix); pb->object_ix = NULL;
      ```
      
      which is not what one woudl expect. While it is not a bug here as it
      would simply become a no-op, the wrong implementation could lead to bugs
      in other occasions.
      
      Fix this by simply removing the macro altogether and replacing it with
      real function calls. This leaves the burden of setting the pointer to
      NULL afterwards to the caller, but this is actually expected and behaves
      like other `free` functions.
      Patrick Steinhardt committed
  2. 17 Feb, 2017 10 commits
  3. 12 Sep, 2015 1 commit
  4. 15 Feb, 2015 1 commit
  5. 13 Feb, 2015 1 commit
  6. 30 Apr, 2014 2 commits
  7. 22 Apr, 2013 2 commits
  8. 08 Jan, 2013 1 commit
  9. 29 Jul, 2012 1 commit
  10. 12 Jul, 2012 1 commit
  11. 25 Apr, 2012 2 commits
    • Rename git_khash_str to git_strmap, etc. · c2b67043
      This renamed `git_khash_str` to `git_strmap`, `git_hash_oid` to
      `git_oidmap`, and deletes `git_hashtable` from the tree, plus
      adds unit tests for `git_strmap`.
      Russell Belfer committed
    • Convert hashtable usage over to khash · 01fed0a8
      This updates khash.h with some extra features (like error checking
      on allocations, ability to use wrapped malloc, foreach calls, etc),
      creates two high-level wrappers around khash: `git_khash_str` and
      `git_khash_oid` for string-to-void-ptr and oid-to-void-ptr tables,
      then converts all of the old usage of `git_hashtable` over to use
      these new hashtables.
      
      For `git_khash_str`, I've tried to create a set of macros that
      yield an API not too unlike the old `git_hashtable` API.  Since
      the oid hashtable is only used in one file, I haven't bother to
      set up all those macros and just use the khash APIs directly for
      now.
      Russell Belfer committed