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

[PATCH 2/6] refs.c: Fix a sparse warning

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Oct 6, 2013, 20:49 UTC
Message-ID
<5251CCCE.5070006@ramsay1.demon.co.uk>

Sparse issues an "Using plain integer as NULL pointer" warning against a call to update_ref_lock() which passes '0' to the 'int *type_p' parameter. In order to suppress the warning, we simply change the argument to 'NULL'.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 refs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/refs.c b/refs.c
index ad5d66c..3710748 100644
--- a/refs.c
+++ b/refs.c
@@ -3235,7 +3235,7 @@ int update_ref(const char *action, const char *refname,
 	       int flags, enum action_on_err onerr)
 {
 	struct ref_lock *lock;
-	lock = update_ref_lock(refname, oldval, flags, 0, onerr);
+	lock = update_ref_lock(refname, oldval, flags, NULL, onerr);
 	if (!lock)
 		return 1;
 	return update_ref_write(action, refname, sha1, lock, onerr);
-- 
1.8.4
Message 1 of 1 in “refs.c: Fix a sparse warning”
  1. 2/6 refs.c: Fix a sparse warningRamsay Jones, Oct 6, 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.