Skip to content

Add struct strmap and associated utility functions

Elijah Newren via GitGitGadget git 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest15 patches 1 replyIn review
  2. v515 patches 8 repliesSuperseded
  3. v413 patches 5 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v313 patches8 repliesSuperseded
v210 patches27 repliesSuperseded
v15 patches18 repliesSuperseded

Changes in v6 from the cover letter

* Fixed a typo in forward declaration of struct mem_pool, spotted by Phillip. (Usage via pointers meant gcc & clang wouldn't complain.)

[1]
https://lore.kernel.org/git/[email protected]/

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15hashmap: add usage documentation explaining hashmap_free[_entries]()hashmap.h+29 -20 replies
2/15hashmap: adjust spacing to fix argument alignmenthashmap.c hashmap.h+20 -190 replies
3/15hashmap: allow re-use after hashmap_free()hashmap.c hashmap.h+17 -20 replies
4/15hashmap: introduce a new hashmap_partial_clear()hashmap.c hashmap.h+39 -130 replies
5/15hashmap: provide deallocation function namesadd-interactive.c blame.c bloom.c +19 more+63 -530 replies
6/15strmap: new utility functionsMakefile strmap.c strmap.h+165 -00 replies
7/15strmap: add more utility functionsstrmap.c strmap.h+54 -00 replies
8/15strmap: enable faster clearing and reusing of strmapsstrmap.c strmap.h+12 -00 replies
9/15strmap: add functions facilitating use as a string->int mapstrmap.c strmap.h+105 -00 replies
10/15strmap: split create_entry() out of strmap_put()strmap.c+23 -140 replies
11/15strmap: add a strset sub-typestrmap.c strmap.h+80 -00 replies
12/15strmap: enable allocations to come from a mem_poolstrmap.c strmap.h+30 -120 replies
13/15strmap: take advantage of FLEXPTR_ALLOC_STR when relevantstrmap.c strmap.h+20 -160 replies
14/15Use new HASHMAP_INIT macro to simplify hashmap initializationattr.c bloom.c builtin/difftool.c +3 more+16 -380 replies
15/15shortlog: use strset from strmap.hbuiltin/shortlog.c+4 -570 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 00/15] Add struct strmap and associated utility functions

Here I introduce new strmap, strintmap, and strset types.

Changes since v5:

* Fixed a typo in forward declaration of struct mem_pool, spotted by Phillip. (Usage via pointers meant gcc & clang wouldn't complain.)

[1]
https://lore.kernel.org/git/[email protected]/

Elijah Newren (15):
hashmap: add usage documentation explaining hashmap_free[_entries]()
hashmap: adjust spacing to fix argument alignment
hashmap: allow re-use after hashmap_free()
hashmap: introduce a new hashmap_partial_clear()
hashmap: provide deallocation function names
strmap: new utility functions
strmap: add more utility functions
strmap: enable faster clearing and reusing of strmaps
strmap: add functions facilitating use as a string->int map
strmap: split create_entry() out of strmap_put()
strmap: add a strset sub-type
strmap: enable allocations to come from a mem_pool
strmap: take advantage of FLEXPTR_ALLOC_STR when relevant Use new HASHMAP_INIT macro to simplify hashmap initialization
shortlog: use strset from strmap.h

 Makefile                |   1 +
 add-interactive.c       |   2 +-
 attr.c                  |  26 ++--
 blame.c                 |   2 +-
 bloom.c                 |   5 +-
 builtin/difftool.c      |   9 +-
 builtin/fetch.c         |   6 +-
 builtin/shortlog.c      |  61 +--------
 config.c                |   2 +-
 diff.c                  |   4 +-
 diffcore-rename.c       |   2 +-
 dir.c                   |   8 +-
 hashmap.c               |  74 +++++++----
 hashmap.h               |  91 +++++++++++---
 merge-recursive.c       |   6 +-
 name-hash.c             |   4 +-
 object.c                |   2 +-
 oidmap.c                |   2 +-
 patch-ids.c             |   2 +-
 range-diff.c            |   6 +-
 ref-filter.c            |   2 +-
 revision.c              |  11 +-
 sequencer.c             |   4 +-
 strmap.c                | 178 ++++++++++++++++++++++++++
 strmap.h                | 268 ++++++++++++++++++++++++++++++++++++++++
 submodule-config.c      |   4 +-
 t/helper/test-hashmap.c |   9 +-
 27 files changed, 621 insertions(+), 170 deletions(-)
 create mode 100644 strmap.c
 create mode 100644 strmap.h

base-commit: d4a392452e292ff924e79ec8458611c0f679d6d4
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-835%2Fnewren%2Fstrmap-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-835/newren/strmap-v6
Pull-Request: https://github.com/git/git/pull/835

Range-diff vs v5:

  1:  af6b6fcb46 =  1:  af6b6fcb46 hashmap: add usage documentation explaining hashmap_free[_entries]()
  2:  591161fd78 =  2:  591161fd78 hashmap: adjust spacing to fix argument alignment
  3:  f2718d036d =  3:  f2718d036d hashmap: allow re-use after hashmap_free()
  4:  61f1da3c51 =  4:  61f1da3c51 hashmap: introduce a new hashmap_partial_clear()
  5:  861e8d65ae =  5:  861e8d65ae hashmap: provide deallocation function names
  6:  448d3b219f =  6:  448d3b219f strmap: new utility functions
  7:  5e8004c728 =  7:  5e8004c728 strmap: add more utility functions
  8:  fd96e9fc8d =  8:  fd96e9fc8d strmap: enable faster clearing and reusing of strmaps
  9:  f499934f54 =  9:  f499934f54 strmap: add functions facilitating use as a string->int map
 10:  3bcceb8cdb = 10:  3bcceb8cdb strmap: split create_entry() out of strmap_put()
 11:  e128a71fec = 11:  e128a71fec strmap: add a strset sub-type
 12:  34f542d9dd ! 12:  3926c4c97b strmap: enable allocations to come from a mem_pool
     @@ strmap.h
       
       #include "hashmap.h"
       
     -+struct mempool;
     ++struct mem_pool;
       struct strmap {
       	struct hashmap map;
      +	struct mem_pool *pool;
 13:  39ec2fa411 = 13:  562595224b strmap: take advantage of FLEXPTR_ALLOC_STR when relevant
 14:  d3713d88f2 = 14:  058e7a6b76 Use new HASHMAP_INIT macro to simplify hashmap initialization
 15:  24e5ce60f5 = 15:  9b494c26c1 shortlog: use strset from strmap.h
Signature · 1 line
gitgitgadget