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

Re: [PATCH] commit-graph: fix sparse 'NULL pointer' warning

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Mar 25, 2019, 17:03 UTC
Message-ID
<755f0706-9738-fc10-23a3-e1797c6925dd@ramsayjones.plus.com>
In-Reply-To
<871s2vcgb1.fsf@evledraar.gmail.com>
On 25/03/2019 12:02, Ævar Arnfjörð Bjarmason wrote:
Show 15 quoted lines
> 
> On Sat, Mar 23 2019, Ramsay Jones wrote:
> 
>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>> ---
>>
>> Hi Ævar,
>>
>> If you need to re-roll your 'ab/commit-graph-fixes' branch, could you
>> please squash this into the relevant patch (commit aeb244adbc
>> ("commit-graph: don't early exit(1) on e.g. \"git status\"", 2019-02-21).
> 
> Thanks. Will squash & re-submit. It's still just in "pu". Is there a
> compiler that warns about it? Didn't on clang/gcc, but then again it's
> just-as-valid-C & just a style issue, so compilers don't care...
This is a 'sparse' warning (see subject line). :-D

I run the 'sparse' Makefile target on each branch and save to a file, sp-out, nsp-out and psp-out, then diff from branch to branch. So, currently, the diff between the 'next' and 'pu' branches look like:

  $ diff nsp-out psp-out
  25a26
  > commit-graph.c:103:24: warning: Using plain integer as NULL pointer
  123a125
  >     SP promisor-remote.c
  188a191
  > upload-pack.c:1167:56: warning: Using plain integer as NULL pointer
  289d291
  <     SP builtin/rebase--interactive.c
  $ 
Alternatively, I can simply run 'sparse' over a single file:
  $ make commit-graph.sp
      SP commit-graph.c
  commit-graph.c:103:24: warning: Using plain integer as NULL pointer
  $ 
Of course, you need to have 'sparse' installed ... ;-)
Show 12 quoted lines
> 
>> This same commit (aeb244adbc) also removes the last call, outside of the
>> commit-graph.c file, to the function load_commit_graph_one(). So, this
>> function is now a file-local symbol and could be marked 'static'.
>>
>> Also, the function verify_commit_graph_lite(), introduced in commit
>> d8acf37ff7 ("commit-graph: fix segfault on e.g. \"git status\"",
>> 2019-02-21), currently has no external callers. This function is also
>> a file-local symbol and could be marked 'static', unless you have plans
>> for future external calls?
> 
> Fixing these too. Just missed them. Thanks.
And these resulted from running my static-check.pl script.

ATB, Ramsay Jones

Previous: Ævar Arnfjörð Bjarmason
Message 3 of 3 in “commit-graph: fix sparse 'NULL pointer' warning”
  1. commit-graph: fix sparse 'NULL pointer' warningRamsay Jones, Mar 23, 2019
  2. Ævar Arnfjörð BjarmasonMar 25, 2019
  3. Ramsay JonesMar 25, 2019

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.