From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Stefan Beller <stefanbeller@googlemail.com>
Cc: Jens.Lehmann@web.de, gitster@pobox.com, git@vger.kernel.org
Subject: Re: [PATCH] diff: remove another ternary expression always evaluating to true
Date: Thu, 8 Aug 2013 23:01:03 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.1.00.1308082257580.24252@s15462909.onlinehome-server.info> (raw)
In-Reply-To: <1375988103-29947-1-git-send-email-stefanbeller@googlemail.com>
Hi Stefan,
On Thu, 8 Aug 2013, Stefan Beller wrote:
> The condition before the changed line dereferences 'one' to query the mode,
> so if the condition evaluates to true, the variable one must not be null.
To show this better, please use -U10 (or some other appropriate context
option) in the future.
> Therefore we do not need the ternary operator depending on one, giving
> either one->path or two->path. This always evaluates to one->path, so we
> can remove the ternary operator.
>
> The condition and the usage of the ternary operator have been introduced
> by the same commit (752c0c24, 2009-10-19, Add the --submodule option to
> the diff option family). As that commit message refers to a GitTogether
> I'd assume that patch was crafted in a hurry, so maybe overlooking the
> need for a ternary operator there.
If this is my code, I do not need a GitTogether to excuse my sloppiness.
In this particular case, I imagine the appropriate fix is to test for
one->path instead of removing the conditional, though.
Ciao,
Johannes
next prev parent reply other threads:[~2013-08-08 21:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 18:55 [PATCH] diff: remove another ternary expression always evaluating to true Stefan Beller
2013-08-08 21:01 ` Johannes Schindelin [this message]
2013-08-08 21:22 ` Stefan Beller
2013-08-08 21:36 ` Johannes Schindelin
2013-08-08 22:03 ` Junio C Hamano
2013-08-08 22:11 ` [PATCH] diff: fix a possible null pointer dereference Stefan Beller
2013-08-08 21:36 ` [PATCH] diff: remove another ternary expression always evaluating to true Philip Oakley
2013-08-08 22:17 ` Stefan Beller
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=alpine.DEB.1.00.1308082257580.24252@s15462909.onlinehome-server.info \
--to=johannes.schindelin@gmx.de \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=stefanbeller@googlemail.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).