{"thread":{"id":"1393","subject":"Fix sparse warnings","startedAt":"2005-08-01T19:11:53Z","lastAt":"2005-08-01T19:11:53Z","messageCount":1,"participants":["Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"6715","messageId":"Pine.LNX.4.58.0508011208280.3341@g5.osdl.org","threadId":"1393","inReplyTo":null,"subject":"Fix sparse warnings","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-01T19:11:53Z","receivedAt":"2005-08-01T19:11:53Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nA few sparse warnings have crept in again since I checked last time:  \nundeclared variables with global scope.\n\nFix them by marking the private variables properly \"static\".\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n----\nBtw, sparse also warns about the \"return 0\" in receive-pack.c: unpack(), \nsince that function is supposed to return void. I think somebody else \nalready sent a patch for that one.\n\n\ndiff --git a/daemon.c b/daemon.c\n--- a/daemon.c\n+++ b/daemon.c\n@@ -71,13 +71,13 @@ static int max_connections = 25;\n \n /* These are updated by the signal handler */\n static volatile unsigned int children_reaped = 0;\n-pid_t dead_child[MAX_CHILDREN];\n+static pid_t dead_child[MAX_CHILDREN];\n \n /* These are updated by the main loop */\n static unsigned int children_spawned = 0;\n static unsigned int children_deleted = 0;\n \n-struct child {\n+static struct child {\n \tpid_t pid;\n \tsocklen_t addrlen;\n \tstruct sockaddr_storage address;\ndiff --git a/rev-cache.c b/rev-cache.c\n--- a/rev-cache.c\n+++ b/rev-cache.c\n@@ -5,7 +5,7 @@\n struct rev_cache **rev_cache;\n int nr_revs, alloc_revs;\n \n-struct rev_list_elem *rle_free;\n+static struct rev_list_elem *rle_free;\n \n #define BATCH_SIZE 512\n \ndiff --git a/server-info.c b/server-info.c\n--- a/server-info.c\n+++ b/server-info.c\n@@ -62,7 +62,7 @@ static int update_info_refs(int force)\n }\n \n /* packs */\n-struct pack_info {\n+static struct pack_info {\n \tunsigned long latest;\n \tstruct packed_git *p;\n \tint old_num;\n"}]}