summaryrefslogtreecommitdiff
path: root/builtin/difftool.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-06 23:30:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 01:20:11 (GMT)
commit87571c3f71ba41d89eef5202f8589daa26f984ca (patch)
treed3b072917efce49f3f95d7d48763a8dfc83ef211 /builtin/difftool.c
parent939af16eac1608766273d3971598dbcc4fe09928 (diff)
downloadgit-87571c3f71ba41d89eef5202f8589daa26f984ca.zip
git-87571c3f71ba41d89eef5202f8589daa26f984ca.tar.gz
git-87571c3f71ba41d89eef5202f8589daa26f984ca.tar.bz2
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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/difftool.c b/builtin/difftool.c
index 4a37b3e..dd94179 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);