Skip to content

Commit 0dda3ac

Browse files
avargitster
authored andcommitted
builtin/difftool.c: { 0 }-initialize rather than using memset()
Refactor an initialization of a variable added in 03831ef (difftool: implement the functionality in the builtin, 2017-01-19). This refactoring makes a subsequent change smaller. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a38d39a commit 0dda3ac

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

builtin/difftool.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
361361
struct hashmap symlinks2 = HASHMAP_INIT(pair_cmp, NULL);
362362
struct hashmap_iter iter;
363363
struct pair_entry *entry;
364-
struct index_state wtindex;
364+
struct index_state wtindex = { 0 };
365365
struct checkout lstate, rstate;
366366
int err = 0;
367367
struct child_process cmd = CHILD_PROCESS_INIT;
@@ -387,8 +387,6 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
387387
mkdir(ldir.buf, 0700);
388388
mkdir(rdir.buf, 0700);
389389

390-
memset(&wtindex, 0, sizeof(wtindex));
391-
392390
memset(&lstate, 0, sizeof(lstate));
393391
lstate.base_dir = lbase_dir = xstrdup(ldir.buf);
394392
lstate.base_dir_len = ldir.len;

0 commit comments

Comments
 (0)