1. 22 Feb, 2019 4 commits
  2. 21 Feb, 2019 12 commits
  3. 20 Feb, 2019 4 commits
  4. 17 Feb, 2019 8 commits
  5. 16 Feb, 2019 1 commit
  6. 15 Feb, 2019 11 commits
    • idxmap: remove legacy low-level interface · df42f368
      Remove the low-level interface that was exposing implementation details of
      `git_idxmap` to callers. From now on, only the high-level functions shall be
      used to retrieve or modify values of a map. Adjust remaining existing callers.
      Patrick Steinhardt committed
    • oidmap: remove legacy low-level interface · bd66925a
      Remove the low-level interface that was exposing implementation details of
      `git_oidmap` to callers. From now on, only the high-level functions shall be
      used to retrieve or modify values of a map. Adjust remaining existing callers.
      Patrick Steinhardt committed
    • offmap: remove legacy low-level interface · 4713e7c8
      Remove the low-level interface that was exposing implementation details of
      `git_offmap` to callers. From now on, only the high-level functions shall be
      used to retrieve or modify values of a map. Adjust remaining existing callers.
      Patrick Steinhardt committed
    • strmap: remove legacy low-level interface · fdfabdc4
      Remove the low-level interface that was exposing implementation details of
      `git_strmap` to callers. From now on, only the high-level functions shall be
      used to retrieve or modify values of a map. Adjust remaining existing callers.
      Patrick Steinhardt committed
    • cache: use iteration interface for cache eviction · 6a9117f5
      To relieve us from memory pressure, we may regularly call `cache_evict_entries`
      to remove some entries from it. Unfortunately, our cache does not support a
      least-recently-used mode or something similar, which is why we evict entries
      completeley at random right now. Thing is, this is only possible due to the map
      interfaces exposing the entry indices, and we intend to completely remove those
      to decouple map users from map implementations. As soon as that is done, we are
      unable to do this random eviction anymore.
      
      Convert this to make use of an iterator for now. Obviously, there is no random
      eviction possible like that anymore, but we'll always start by evicting from the
      beginning of the map. Due to hashing, one may hope that the selected buckets
      will be evicted at least in some way unpredictably. But more likely than not,
      this will not be the case. But let's see what happens and if any users complain
      about degraded performance. If so, we might come up with a different scheme than
      random removal, e.g. by using an LRU cache.
      Patrick Steinhardt committed
    • indexer: use map iterator to delete expected OIDs · c976b4f9
      To compute whether there are objects missing in a packfile, the indexer keeps
      around a map of OIDs that it still expects to see. This map does not store any
      values at all, but in fact the keys are owned by the map itself. Right now, we
      free these keys by iterating over the map and freeing the key itself, which is
      kind of awkward as keys are expected to be constant.
      
      We can make this a bit prettier by inserting the OID as value, too. As we
      already store the `NULL` pointer either way, this does not increase memory
      usage, but makes the code a tad more clear. Furthermore, we convert the
      previously existing map iteration via indices to make use of an iterator,
      instead.
      Patrick Steinhardt committed
    • maps: provide high-level iteration interface · 18cf5698
      Currently, our headers need to leak some implementation details of maps due to
      their direct use of indices in the implementation of their foreach macros. This
      makes it impossible to completely hide the map structures away, and also makes
      it impossible to include the khash implementation header in the C files of the
      respective map only.
      
      This is now being fixed by providing a high-level iteration interface
      `map_iterate`, which takes as inputs the map that shall be iterated over, an
      iterator as well as the locations where keys and values shall be put into. For
      simplicity's sake, the iterator is a simple `size_t` that shall initialized to
      `0` on the first call. All existing foreach macros are then adjusted to make use
      of this new function.
      Patrick Steinhardt committed
    • maps: use high-level function to check existence of keys · c50a8ac2
      Some callers were still using the tightly-coupled pattern of `lookup_index` and
      `valid_index` to verify that an entry exists in a map. Instead, use the more
      high-level `exists` functions to decouple map users from its implementation.
      Patrick Steinhardt committed
    • maps: provide return value when deleting entries · 84a089da
      Currently, the delete functions of maps do not provide a return value. Like
      this, it is impossible to tell whether the entry has really been deleted or not.
      Change the implementation to provide either a return value of zero if the entry
      has been successfully deleted or `GIT_ENOTFOUND` if the key could not be found.
      
      Convert callers to the `delete_at` functions to instead use this higher-level
      interface.
      Patrick Steinhardt committed
    • idxmap: have `resize` functions return proper error code · 8da93944
      The currently existing function `git_idxmap_resize` and
      `git_idxmap_icase_resize` do not return any error codes at all due to their
      previous implementation making use of a macro. Due to that, it is impossible to
      see whether the resize operation might have failed due to an out-of-memory
      situation.
      
      Fix this by providing a proper error code. Adjust callers to make use of it.
      Patrick Steinhardt committed
    • idxmap: introduce high-level setter for key/value pairs · 661fc57b
      Currently, one would use the function `git_idxmap_insert` to insert key/value
      pairs into a map. This function has historically been a macro, which is why its
      syntax is kind of weird: instead of returning an error code directly, it instead
      has to be passed a pointer to where the return value shall be stored. This does
      not match libgit2's common idiom of directly returning error codes.
      
      Introduce a new function `git_idxmap_set`, which takes as parameters the map,
      key and value and directly returns an error code. Convert all callers of
      `git_idxmap_insert` to make use of it.
      Patrick Steinhardt committed