diff options
author | Eric Wong <e@80x24.org> | 2019-10-06 23:30:38 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 10:20:11 +0900 |
commit | 87571c3f71ba41d89eef5202f8589daa26f984ca (patch) | |
tree | d3b072917efce49f3f95d7d48763a8dfc83ef211 /builtin/difftool.c | |
parent | hashmap_cmp_fn takes hashmap_entry params (diff) | |
download | tgif-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/difftool.c')
-rw-r--r-- | builtin/difftool.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/difftool.c b/builtin/difftool.c index 4a37b3edee..dd94179b68 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -538,8 +538,8 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix, * temporary file to both the left and right directories to show the * change in the recorded SHA1 for the submodule. */ - hashmap_iter_init(&submodules, &iter); - while ((entry = hashmap_iter_next(&iter))) { + hashmap_for_each_entry(&submodules, &iter, entry, + struct pair_entry, entry /* member name */) { if (*entry->left) { add_path(&ldir, ldir_len, entry->path); ensure_leading_directories(ldir.buf); @@ -557,8 +557,8 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix, * shows only the link itself, not the contents of the link target. * This loop replicates that behavior. */ - hashmap_iter_init(&symlinks2, &iter); - while ((entry = hashmap_iter_next(&iter))) { + hashmap_for_each_entry(&symlinks2, &iter, entry, + struct pair_entry, entry /* member name */) { if (*entry->left) { add_path(&ldir, ldir_len, entry->path); ensure_leading_directories(ldir.buf); |