summaryrefslogtreecommitdiff
path: root/builtin/difftool.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2023-01-12 12:55:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2023-01-16 18:46:58 (GMT)
commit2f6b1eb794ee1f152c1a4b519e3b6dcecd0b487f (patch)
treece148cd756ca33dd7147a7136eb33c30530da8eb /builtin/difftool.c
parent5bdf6d4ac0d06817ce22322aa0172b49e6026544 (diff)
downloadgit-2f6b1eb794ee1f152c1a4b519e3b6dcecd0b487f.zip
git-2f6b1eb794ee1f152c1a4b519e3b6dcecd0b487f.tar.gz
git-2f6b1eb794ee1f152c1a4b519e3b6dcecd0b487f.tar.bz2
cache API: add a "INDEX_STATE_INIT" macro/function, add release_index()
Hopefully in some not so distant future, we'll get advantages from always initializing the "repo" member of the "struct index_state". To make that easier let's introduce an initialization macro & function. The various ad-hoc initialization of the structure can then be changed over to it, and we can remove the various "0" assignments in discard_index() in favor of calling index_state_init() at the end. While not strictly necessary, let's also change the CALLOC_ARRAY() of various "struct index_state *" to use an ALLOC_ARRAY() followed by index_state_init() instead. We're then adding the release_index() function and converting some callers (including some of these allocations) over to it if they either won't need to use their "struct index_state" again, or are just about to call index_state_init(). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/difftool.c')
-rw-r--r--builtin/difftool.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/difftool.c b/builtin/difftool.c
index 1f9d432..758e7bd 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -361,7 +361,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
struct hashmap symlinks2 = HASHMAP_INIT(pair_cmp, NULL);
struct hashmap_iter iter;
struct pair_entry *entry;
- struct index_state wtindex = { 0 };
+ struct index_state wtindex = INDEX_STATE_INIT;
struct checkout lstate, rstate;
int err = 0;
struct child_process cmd = CHILD_PROCESS_INIT;