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

Re: [PATCH] revision.c: Remove unneeded check for NULL

From
Jeff King <peff@peff.net>
Date
Jun 27, 2015, 06:07 UTC
Message-ID
<20150627060710.GA9353@peff.net>
In-Reply-To
<1435347619-29410-1-git-send-email-sbeller@google.com>
On Fri, Jun 26, 2015 at 12:40:19PM -0700, Stefan Beller wrote:
> The function is called only from one place, which makes sure
> to have `interesting_cache` not NULL. Additionally it is a
> dereferenced a few lines before unconditionally, which would
> result in a segmentation fault.
Yeah, I think this is the right thing to do.
Acked-by: Jeff King <peff@peff.net>
Show 10 quoted lines
>     > Should there be
>     >
>     >        if (!interesting_cache)
>     >                die("BUG: &interesting_cache == NULL");
>     >
>     > checks at the top of still_interesting and everybody_uninteresting to
>     > futureproof this?
>     
>     I don't think this is necessary as these functions are local functions
>     so when somebody wants to use them they will be aware of the limitations.

Agreed. We do not assert non-NULL for every parameter in our functions, and I do not think this is any more special than the others.

>     > This code seems to be underdocumented.
>     
>     I am not a expert in this area of the code, so I hoped Peff
>     would document it if he feels like so.

I kind of thought that the explanation in b6e8a3b covered this code. Does it not, or did people not read it?

The whole of revision.c is not well documented by comments, but I don't think that is a new thing.

-Peff
Previous: Stefan BellerNext: Jonathan Nieder
Message 2 of 3 in “revision.c: Remove unneeded check for NULL”
  1. revision.c: Remove unneeded check for NULLStefan Beller, Jun 26, 2015
  2. Jeff KingJun 27, 2015
  3. Jonathan NiederJun 30, 2015

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.