git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Pratyush Yadav <me@yadavpratyush.com>
Cc: <git@vger.kernel.org>
Subject: Re: [PATCH 1/1] git-gui: remove unused global declarations
Date: Fri, 25 Oct 2019 12:54:26 +0900	[thread overview]
Message-ID: <xmqq1rv1eaz1.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20191025013255.7367-2-me@yadavpratyush.com> (Pratyush Yadav's message of "Fri, 25 Oct 2019 07:02:55 +0530")

Pratyush Yadav <me@yadavpratyush.com> writes:

>  proc next_diff {{after {}}} {
> -	global next_diff_p next_diff_w next_diff_i
> +	global next_diff_p next_diff_w
>  	show_diff $next_diff_p $next_diff_w {} {} $after
>  }

Not in particular about next_diff_i, but seeing a hunk like this
makes me wonder if you want to go the other way around.  If a future
fix needs to (re)introduce the use of next_diff_i global variable in
this proc (it seems that there are two procs that declare the
variable as global, one of which is this one, and the other one
assigns to it), the code change must resurrect this declaration;
otherwise the code would only confuse itself by potentially having
two variables (one global, one local) with the same name, no?

For next_diff_i in particular, I think the right solution would be
to remove both global decl and the assignment, as the assignment is
made to otherwise unused variable.  But the primary point in such a
change is not "remove unused global decl"; it is "remove unused
variable".


  reply	other threads:[~2019-10-25  3:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  1:32 [PATCH 0/1] " Pratyush Yadav
2019-10-25  1:32 ` [PATCH 1/1] " Pratyush Yadav
2019-10-25  3:54   ` Junio C Hamano [this message]
2019-10-29 21:32     ` Pratyush Yadav
2019-10-28 13:15 ` [PATCH 0/1] " Johannes Schindelin
2019-10-29 19:09   ` Pratyush Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq1rv1eaz1.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=me@yadavpratyush.com \
    --subject='Re: [PATCH 1/1] git-gui: remove unused global declarations' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).