git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] multi-pack-index: avoid dead store for struct progress
@ 2018-10-18 18:59 Carlo Marcelo Arenas Belón
  2018-10-18 19:36 ` Derrick Stolee
  2018-10-19  2:26 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2018-10-18 18:59 UTC (permalink / raw)
  To: git; +Cc: dstolee, Carlo Marcelo Arenas Belón

it is initialized unconditionally by a call to start_progress
below.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 midx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/midx.c b/midx.c
index ea2f3ffe2e..4fac0cd08a 100644
--- a/midx.c
+++ b/midx.c
@@ -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;
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] multi-pack-index: avoid dead store for struct progress
  2018-10-18 18:59 [PATCH] multi-pack-index: avoid dead store for struct progress Carlo Marcelo Arenas Belón
@ 2018-10-18 19:36 ` Derrick Stolee
  2018-10-18 19:56   ` Carlo Arenas
  2018-10-19  2:26 ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Derrick Stolee @ 2018-10-18 19:36 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belón, git; +Cc: dstolee

On 10/18/2018 2:59 PM, Carlo Marcelo Arenas Belón wrote:
> it is initialized unconditionally by a call to start_progress
> below.
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>   midx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/midx.c b/midx.c
> index ea2f3ffe2e..4fac0cd08a 100644
> --- a/midx.c
> +++ b/midx.c
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] multi-pack-index: avoid dead store for struct progress
  2018-10-18 19:36 ` Derrick Stolee
@ 2018-10-18 19:56   ` Carlo Arenas
  0 siblings, 0 replies; 4+ messages in thread
From: Carlo Arenas @ 2018-10-18 19:56 UTC (permalink / raw)
  To: stolee; +Cc: git, dstolee

On Thu, Oct 18, 2018 at 12:36 PM Derrick Stolee <stolee@gmail.com> wrote:
>
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] multi-pack-index: avoid dead store for struct progress
  2018-10-18 18:59 [PATCH] multi-pack-index: avoid dead store for struct progress Carlo Marcelo Arenas Belón
  2018-10-18 19:36 ` Derrick Stolee
@ 2018-10-19  2:26 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2018-10-19  2:26 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belón; +Cc: git, dstolee

Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:

> it is initialized unconditionally by a call to start_progress
> below.
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  midx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/midx.c b/midx.c
> index ea2f3ffe2e..4fac0cd08a 100644
> --- a/midx.c
> +++ b/midx.c
> @@ -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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-19  2:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-18 18:59 [PATCH] multi-pack-index: avoid dead store for struct progress Carlo Marcelo Arenas Belón
2018-10-18 19:36 ` Derrick Stolee
2018-10-18 19:56   ` Carlo Arenas
2018-10-19  2:26 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).