multi-pack-index: avoid dead store for struct progress
PATCH 1/1 multi-pack-index: avoid dead store for struct progress
it is initialized unconditionally by a call to start_progress below.
--- midx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
midx.c +1 -1
@@ -941,7 +941,7 @@ static void midx_report(const char *fmt, ...)int verify_midx_file (const char *object_dir) {uint32_t i; -struct progress *progress =NULL ; +struct progress *progress;struct multi_pack_index *m =load_multi_pack_index (object_dir,1 ); verify_midx_error =0 ;
Signature · 1 line
2.19.1
Quoted 13 lines · Carlo Marcelo Arenas Belón
it is initialized unconditionally by a call to
start_progressbelow.Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- midx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)midx.c +0
-0
midx.c static void midx_report(const char *fmt, ...) · line 947
Quoted 8 lines
midx.c +1
-1@@ -941,7 +941,7 @@ static void midx_report(const char *fmt, ...)int verify_midx_file (const char *object_dir) {uint32_t i; -struct progress *progress =NULL ; +struct progress *progress;struct multi_pack_index *m =load_multi_pack_index (object_dir,1 ); verify_midx_error =0 ;
This makes sense as a cleanup. Is there a tool that reports a wasted initialization that you used to find this?
-Stolee
Quoted 3 lines · Derrick Stolee
Is there a tool that reports a wasted
initialization that you used to find this?
I'd used clang's analyzer recently to track a similar issue before in a different codebase, but not for this specific case.
Carlo
Quoted 13 lines · Carlo Marcelo Arenas Belón
it is initialized unconditionally by a call to
start_progressbelow.Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- midx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)midx.c +0
-0
midx.c static void midx_report(const char *fmt, ...) · line 946
Quoted 7 lines
midx.c +1
-1@@ -941,7 +941,7 @@ static void midx_report(const char *fmt, ...)int verify_midx_file (const char *object_dir) {uint32_t i; -struct progress *progress =NULL ; +struct progress *progress;struct multi_pack_index *m =load_multi_pack_index (object_dir,1 ); verify_midx_error =0 ;
Both changes make sense. It's kind of surprising that this still matters, though; I would have expected a compiler would notice.