Sparse: fix some "symbol not declared" warnings (Part 3)
RFC PATCH 5/10 Sparse: fix some "symbol not declared" warnings (Part 3)
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 <[email protected]>
--- 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(-)
builtin-runstatus.c +2 -4
@@ -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" ;
generate-cmdlist.sh +1 -1
@@ -7,7 +7,7 @@ struct cmdname_help char help[80]; }; -struct cmdname_help common_cmds[] = {" +static struct cmdname_help common_cmds[] = {" sort <<\EOF | add
http.h +1 -1
@@ -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;
wt-status.c +9 -3
@@ -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; +} +
wt-status.h +1 -0
@@ -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 */
Signature · 1 line
1.5.2