summaryrefslogtreecommitdiff
path: root/builtin/describe.c
diff options
context:
space:
mode:
authorLibravatar Eric Wong <e@80x24.org>2019-10-06 23:30:38 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-10-07 10:20:11 +0900
commit87571c3f71ba41d89eef5202f8589daa26f984ca (patch)
treed3b072917efce49f3f95d7d48763a8dfc83ef211 /builtin/describe.c
parenthashmap_cmp_fn takes hashmap_entry params (diff)
downloadtgif-87571c3f71ba41d89eef5202f8589daa26f984ca.tar.xz
hashmap: use *_entry APIs for iteration
Inspired by list_for_each_entry in the Linux kernel. Once again, these are somewhat compromised usability-wise by compilers lacking __typeof__ support. Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/describe.c')
-rw-r--r--builtin/describe.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index e9267b5c9c..8cf2cd992d 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -333,8 +333,8 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
struct commit_name *n;
init_commit_names(&commit_names);
- n = hashmap_iter_first(&names, &iter);
- for (; n; n = hashmap_iter_next(&iter)) {
+ hashmap_for_each_entry(&names, &iter, n, struct commit_name,
+ entry /* member name */) {
c = lookup_commit_reference_gently(the_repository,
&n->peeled, 1);
if (c)