git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff: remove another ternary expression always evaluating to true

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 8, 2013, 22:03 UTC
Message-ID
<7v8v0b96xe.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.1.00.1308082335050.24252@s15462909.onlinehome-server.info>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 11 quoted lines
> Hi Stefan,
>
> On Thu, 8 Aug 2013, Stefan Beller wrote:
>
>> So you rather propose to have 
>> -		show_submodule_summary(o->file, one ? one->path : two->path,
>> +		show_submodule_summary(o->file, one->path ? one->path : two->path,
>
> I do. The reason is that one->path could be NULL (but not both one->path
> and two->path) and the summary would not be as helpful as possible if it
> wrote "(null)" instead of the path of the submodule.
Good.

Also some C libraries would choke when asked to %s format a NULL, instead of giving "(null)" to avoid segfaulting (which I think is a quirk in glibc).

Previous: Johannes SchindelinNext: Stefan Beller
Message 5 of 8 in “diff: remove another ternary expression always evaluating to true”
  1. diff: remove another ternary expression always evaluating to trueStefan Beller, Aug 8, 2013
  2. Johannes SchindelinAug 8, 2013
  3. Stefan BellerAug 8, 2013
  4. Johannes SchindelinAug 8, 2013
  5. Junio C HamanoAug 8, 2013
  6. diff: fix a possible null pointer dereferenceStefan Beller, Aug 8, 2013
  7. Philip OakleyAug 8, 2013
  8. Stefan BellerAug 8, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.