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

[PATCH 3/6] wrapper.c: Fix a sparse warning

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

When the NO_MKSTEMPS build variable is not set, sparse issues an "'gitmkstemps' was not declared. Should it be static?" warning. The 'gitmkstemps' function definition is only required when the NO_MKSTEMPS variable is set. In order to suppress the warning, use a preprocessor conditional to include the definition only when needed.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 wrapper.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/wrapper.c b/wrapper.c
index f92b147..9a6aaaf 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -360,10 +360,12 @@ int git_mkstemp_mode(char *pattern, int mode)
 	return git_mkstemps_mode(pattern, 0, mode);
 }
 
+#ifdef NO_MKSTEMPS
 int gitmkstemps(char *pattern, int suffix_len)
 {
 	return git_mkstemps_mode(pattern, suffix_len, 0600);
 }
+#endif
 
 int xmkstemp_mode(char *template, int mode)
 {
-- 
1.8.4
Message 1 of 1 in “wrapper.c: Fix a sparse warning”
  1. 3/6 wrapper.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.