DORMANTno replies

[Patch] Fix sparse warnings

From: Alecs King <hidden>
Date: 2016-06-15 22:42:03
Subsystem: the rest · Maintainer: Linus Torvalds

fix one 'should it be static?' warning and
two 'mixing declarations and code' warnings.

Signed-off-by: Alecs King <redacted>
---

 connect.c        |    3 ++-
 ssh-pull.c       |    2 +-
 tools/mailinfo.c |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/connect.c b/connect.c
--- a/connect.c
+++ b/connect.c
@@ -219,6 +219,7 @@ static struct ref *find_ref_by_name(stru
 int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
 	       int nr_refspec, char **refspec, int all)
 {
+	int len;
 	struct refspec *rs = parse_ref_spec(nr_refspec, refspec);
 
 	if (nr_refspec)
@@ -236,7 +237,7 @@ int match_refs(struct ref *src, struct r
 			if (!all)
 				continue;
 			/* Create a new one and link it */
-			int len = strlen(src->name) + 1;
+			len = strlen(src->name) + 1;
 			dst_peer = xcalloc(1, sizeof(*dst_peer) + len);
 			memcpy(dst_peer->name, src->name, len);
 			memcpy(dst_peer->new_sha1, src->new_sha1, 20);
diff --git a/ssh-pull.c b/ssh-pull.c
--- a/ssh-pull.c
+++ b/ssh-pull.c
@@ -10,7 +10,7 @@ static int fd_out;
 static unsigned char remote_version = 0;
 static unsigned char local_version = 1;
 
-ssize_t force_write(int fd, void *buffer, size_t length)
+static ssize_t force_write(int fd, void *buffer, size_t length)
 {
 	ssize_t ret = 0;
 	while (ret < length) {
diff --git a/tools/mailinfo.c b/tools/mailinfo.c
--- a/tools/mailinfo.c
+++ b/tools/mailinfo.c
@@ -152,13 +152,13 @@ static void cleanup_space(char *buf)
 
 static void handle_rest(void)
 {
+	FILE *out = cmitmsg;
 	char *sub = cleanup_subject(subject);
 	cleanup_space(name);
 	cleanup_space(date);
 	cleanup_space(email);
 	cleanup_space(sub);
 	printf("Author: %s\nEmail: %s\nSubject: %s\nDate: %s\n\n", name, email, sub, date);
-	FILE *out = cmitmsg;
 
 	do {
 		if (!memcmp("diff -", line, 6) ||
-- 
Alecs King
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help