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

[PATCH] repository: fix a sparse 'using integer as NULL pointer' warning

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Nov 28, 2017, 03:01 UTC
Message-ID
<69fdc850-da71-6df3-5299-eb67ef5d74df@ramsayjones.plus.com>

Commit 78a6766802 ("Integrate hash algorithm support with repo setup", 2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the repository structure, without modifying the initializer of the 'the_repo' variable. This does not actually introduce a bug, since the '0' initializer for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence the warning), and the final field (now with no initializer) receives a default '0'.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Junio,

I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but now that it has been merged into the 'next' branch, sparse is barking on that branch too. This patch (slightly different to the last one) applies on top of 'next'.

ATB, Ramsay Jones

[1] https://public-inbox.org/git/%3C91150cfc-3271-16b0-33d3-9a4e149dc9fe@ramsayjones.plus.com%3E/
 repository.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/repository.c b/repository.c
index c6ceb9f9e..998413b8b 100644
--- a/repository.c
+++ b/repository.c
@@ -5,7 +5,7 @@
 
 /* The main repository */
 static struct repository the_repo = {
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, 0, 0
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, NULL, 0, 0
 };
 struct repository *the_repository = &the_repo;
 
-- 
2.15.0
Next: Junio C Hamano
Message 1 of 4 in “repository: fix a sparse 'using integer as NULL pointer' warning”
  1. repository: fix a sparse 'using integer as NULL pointer' warningRamsay Jones, Nov 28, 2017
  2. Junio C HamanoNov 28, 2017
  3. brian m. carlsonNov 29, 2017
  4. Ramsay JonesNov 29, 2017

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.