Skip to contentSkip to conversation

wrapper.c: Fix a sparse warning

PATCH In review Ramsay Jones 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

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.

---
 wrapper.c | 2 ++
 1 file changed, 2 insertions(+)
wrapper.c +2 -0
index f92b147..9a6aaaf 100644
@@ -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)
 {
Signature · 1 line
1.8.4