[RFC][PATCH 05/10] Sparse: fix some "symbol not declared" warnings (Part 3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This commit removes this warning, in various ways, for three more
symbols, thus:

    - 'common_cmds': this symbol is created by the generate-cmdlist.sh
      script, so modify the script to include the static keyword in
      the declaration.

    - 'curl_ftp_no_epsv': add declaration to http.h header file.
      (Note that it could be declared static in http.c, but so could
      several other variables in that header; just being consistent)

    - 'wt_status_use_color': add a declaration to the wt-status.h
      header file, but change the symbol to a function at the same
      time.

Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxx>
---
 builtin-runstatus.c |    6 ++----
 generate-cmdlist.sh |    2 +-
 http.h              |    2 +-
 wt-status.c         |   12 +++++++++---
 wt-status.h         |    1 +
 5 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/builtin-runstatus.c b/builtin-runstatus.c
index d7b04cb..1a9a647 100644
--- a/builtin-runstatus.c
+++ b/builtin-runstatus.c
@@ -2,8 +2,6 @@
 #include "wt-status.h"
 #include "builtin.h"
 
-extern int wt_status_use_color;
-
 static const char runstatus_usage[] =
 "git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]";
 
@@ -17,9 +15,9 @@ int cmd_runstatus(int argc, const char **argv, const char *prefix)
 
 	for (i = 1; i < argc; i++) {
 		if (!strcmp(argv[i], "--color"))
-			wt_status_use_color = 1;
+			wt_status_use_color(1);
 		else if (!strcmp(argv[i], "--nocolor"))
-			wt_status_use_color = 0;
+			wt_status_use_color(0);
 		else if (!strcmp(argv[i], "--amend")) {
 			s.amend = 1;
 			s.reference = "HEAD^1";
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 975777f..17df47b 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -7,7 +7,7 @@ struct cmdname_help
     char help[80];
 };
 
-struct cmdname_help common_cmds[] = {"
+static struct cmdname_help common_cmds[] = {"
 
 sort <<\EOF |
 add
diff --git a/http.h b/http.h
index 69b6b66..9070e6f 100644
--- a/http.h
+++ b/http.h
@@ -99,9 +99,9 @@ extern char *ssl_capath;
 extern char *ssl_cainfo;
 extern long curl_low_speed_limit;
 extern long curl_low_speed_time;
+extern int curl_ftp_no_epsv;
 
 extern struct curl_slist *pragma_header;
-extern struct curl_slist *no_range_header;
 
 extern struct active_request_slot *active_queue_head;
 
diff --git a/wt-status.c b/wt-status.c
index fd8a877..9fa9100 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -8,7 +8,7 @@
 #include "revision.h"
 #include "diffcore.h"
 
-int wt_status_use_color = 0;
+static int use_color = 0;
 static char wt_status_colors[][COLOR_MAXLEN] = {
 	"",         /* WT_STATUS_HEADER: normal */
 	"\033[32m", /* WT_STATUS_UPDATED: green */
@@ -39,7 +39,7 @@ static int parse_status_slot(const char *var, int offset)
 
 static const char* color(int slot)
 {
-	return wt_status_use_color ? wt_status_colors[slot] : "";
+	return use_color ? wt_status_colors[slot] : "";
 }
 
 void wt_status_prepare(struct wt_status *s)
@@ -349,7 +349,7 @@ void wt_status_print(struct wt_status *s)
 int git_status_config(const char *k, const char *v)
 {
 	if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
-		wt_status_use_color = git_config_colorbool(k, v);
+		use_color = git_config_colorbool(k, v);
 		return 0;
 	}
 	if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
@@ -358,3 +358,9 @@ int git_status_config(const char *k, const char *v)
 	}
 	return git_default_config(k, v);
 }
+
+void wt_status_use_color(int please)
+{
+	use_color = please;
+}
+
diff --git a/wt-status.h b/wt-status.h
index cfea4ae..dd4421a 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -24,5 +24,6 @@ struct wt_status {
 int git_status_config(const char *var, const char *value);
 void wt_status_prepare(struct wt_status *s);
 void wt_status_print(struct wt_status *s);
+void wt_status_use_color(int please);
 
 #endif /* STATUS_H */
-- 
1.5.2


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux