git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Pratyush Yadav <me@yadavpratyush.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/1] git-gui: remove unused global declarations
Date: Wed, 30 Oct 2019 03:02:03 +0530	[thread overview]
Message-ID: <20191029213202.67mmtd3lo324bhmx@yadavpratyush.com> (raw)
In-Reply-To: <xmqq1rv1eaz1.fsf@gitster-ct.c.googlers.com>

On 25/10/19 12:54PM, Junio C Hamano wrote:
> 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?

I'm not sure what you mean by this. Do you mean we should keep 
next_diff_i global, or do you mean we should instead convert it to a 
local variable?

Or is it related to similar sounding variable names (next_diff_i, 
next_diff_w, next_diff_p), which appear in multiple functions together?
 
> 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".

Thanks for spotting it! Will fix.

-- 
Regards,
Pratyush Yadav

  reply	other threads:[~2019-10-29 21:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  1:32 [PATCH 0/1] git-gui: remove unused global declarations Pratyush Yadav
2019-10-25  1:32 ` [PATCH 1/1] " Pratyush Yadav
2019-10-25  3:54   ` Junio C Hamano
2019-10-29 21:32     ` Pratyush Yadav [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20191029213202.67mmtd3lo324bhmx@yadavpratyush.com \
    --to=me@yadavpratyush.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).