Skip to contentSkip to conversation

config.c: Fix a sparse warning

PATCH In review Ramsay Jones 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 config.c: Fix a sparse warning

Sparse issues an "'git_parse_unsigned' was not declared. Should it be static?" warning. In order to suppress this warning, since this symbol only requires file scope, we simply add the static modifier to its declaration.

---
 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
config.c +1 -1
index 6588cf5..e1d66a1 100644
@@ -498,7 +498,7 @@ static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
 	return 0;
 }
 
-int git_parse_unsigned(const char *value, uintmax_t *ret, uintmax_t max)
+static int git_parse_unsigned(const char *value, uintmax_t *ret, uintmax_t max)
 {
 	if (value && *value) {
 		char *end;
Signature · 1 line
1.8.4
#1 lore raw
Quoted 4 lines · Ramsay Jones

Sparse issues an "'git_parse_unsigned' was not declared. Should it be static?" warning. In order to suppress this warning, since this symbol only requires file scope, we simply add the static modifier to its declaration.

Thanks. This one is my fault. Commit 7192777 refactors git_parse_ulong, which is public, into a more generic function. But since we kept the git_parse_ulong wrapper, only that part needs to be public; nobody outside the file calls the lower-level git_parse_unsigned.

-Peff