builtin/difftool.c: { 0 }-initialize rather than using memset()
Refactor an initialization of a variable added in 03831ef7b50 (difftool: implement the functionality in the builtin, 2017-01-19). This refactoring makes a subsequent change smaller. 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>
Ævar Arnfjörð Bjarmason committed
Jan 12, 2023 at 13:55 UTC
0dda3ac92564e4e3f26a341103c67629e926ab40
1 file changed
+1
-3
builtin/difftool.c
+1
-3
@@ -361,7 +361,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
361
struct hashmap symlinks2 = HASHMAP_INIT(pair_cmp, NULL);
362
struct hashmap_iter iter;
363
struct pair_entry *entry;
364
- struct index_state wtindex;
364
+ struct index_state wtindex = { 0 };
365
struct checkout lstate, rstate;
366
int err = 0;
367
struct child_process cmd = CHILD_PROCESS_INIT;
@@ -387,8 +387,6 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
387
mkdir(ldir.buf, 0700);
388
mkdir(rdir.buf, 0700);
389
390
- memset(&wtindex, 0, sizeof(wtindex));
391
-
390
memset(&lstate, 0, sizeof(lstate));
391
lstate.base_dir = lbase_dir = xstrdup(ldir.buf);
392
lstate.base_dir_len = ldir.len;