mbox

[00/11] hashmap: bugfixes, safety fixes, and WIP improvements

Message ID 20190826024332.3403-1-e@80x24.org (mailing list archive)
State New, archived
Headers show

Pull-request

https://80x24.org/git-svn.git hashmap-wip-v1

Message

Eric Wong Aug. 26, 2019, 2:43 a.m. UTC
This started out as yak-shaving exercise to introduce the
"container_of" macro to make hashmap more flexible and
less error-prone.

So far I've ended up finding and fixing two real bugs in
patches 1/11 and 2/11 which should be fast-tracked.

Patches 3-9 are straightforward safety fixes to prevent future
bugs of the same type.

10-11 are work-in-progress changes to remove the limitation
of hashmap_entry being the first member of a struct.  It's
also part of my ongoing agenda to spread Linux kernel idioms
into userspace and maybe get git.git hackers more comfortable
with kernel hacking (and vice-versa :>)

I'll try to continue the rest within the next few days.


The following changes since commit 745f6812895b31c02b29bdfe4ae8e5498f776c26:

  First batch after Git 2.23 (2019-08-22 12:41:04 -0700)

are available in the Git repository at:

  https://80x24.org/git-svn.git hashmap-wip-v1

for you to fetch changes up to 4d9857917670218cba447caddec15a2734c86e2c:

  hashmap_get_next returns "struct hashmap_entry *" (2019-08-26 02:25:35 +0000)

----------------------------------------------------------------
Eric Wong (11):
      diff: use hashmap_entry_init on moved_entry.ent
      packfile: use hashmap_entry in delta_base_cache_entry
      hashmap_entry_init takes "struct hashmap_entry *"
      hashmap_entry: detect improper initialization
      hashmap_get_next takes "const struct hashmap_entry *"
      hashmap_add takes "struct hashmap_entry *"
      hashmap_get takes "const struct hashmap_entry *"
      hashmap_remove takes "const struct hashmap_entry *"
      hashmap_put takes "struct hashmap_entry *"
      introduce container_of macro
      hashmap_get_next returns "struct hashmap_entry *"

 attr.c                              |  8 +++----
 blame.c                             | 12 +++++-----
 builtin/describe.c                  |  4 ++--
 builtin/difftool.c                  | 17 +++++++-------
 builtin/fast-export.c               |  9 ++++----
 builtin/fetch.c                     |  4 ++--
 config.c                            |  8 +++----
 diff.c                              | 23 ++++++++++++-------
 diffcore-rename.c                   | 15 ++++++++-----
 git-compat-util.h                   | 10 +++++++++
 hashmap.c                           | 30 ++++++++++++++-----------
 hashmap.h                           | 45 +++++++++++++++++++++----------------
 merge-recursive.c                   | 27 +++++++++++-----------
 name-hash.c                         | 41 +++++++++++++++++----------------
 oidmap.c                            |  2 +-
 packfile.c                          |  8 +++----
 patch-ids.c                         |  6 ++---
 range-diff.c                        |  8 +++----
 ref-filter.c                        |  5 +++--
 refs.c                              |  7 ++++--
 remote.c                            |  8 ++++---
 revision.c                          |  9 ++++----
 sequencer.c                         |  9 ++++----
 sub-process.c                       | 10 ++++-----
 submodule-config.c                  | 20 ++++++++---------
 t/helper/test-hashmap.c             | 24 +++++++++++---------
 t/helper/test-lazy-init-name-hash.c |  4 ++--
 27 files changed, 210 insertions(+), 163 deletions(-)