git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] test-string-list.c: Fix some sparse warnings
@ 2012-09-15 16:18 Ramsay Jones
  2012-09-15 20:52 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Ramsay Jones @ 2012-09-15 16:18 UTC (permalink / raw)
  To: mhagger; +Cc: Junio C Hamano, GIT Mailing-list


In particular, sparse complains as follows:

        SP test-string-list.c
    test-string-list.c:10:6: warning: symbol 'parse_string_list' was not \
        declared. Should it be static?
    test-string-list.c:18:6: warning: symbol 'write_list' was not \
        declared. Should it be static?
    test-string-list.c:25:6: warning: symbol 'write_list_compact' was not \
        declared. Should it be static?
    test-string-list.c:38:5: warning: symbol 'prefix_cb' was not \
        declared. Should it be static?

In order to suppress the warnings, since the above symbols do not
need more than file scope, we simply include the static modifier
in their declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Hi Michael,

If you need to re-roll your 'mh/string-list' branch, could you
please squash the relevent parts of this patch into those commits.

Thanks!

ATB,
Ramsay Jones

 test-string-list.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test-string-list.c b/test-string-list.c
index 5e9631f..4693295 100644
--- a/test-string-list.c
+++ b/test-string-list.c
@@ -7,7 +7,7 @@
  * list (as opposed to "", which indicates a string list containing a
  * single empty string).  list->strdup_strings must be set.
  */
-void parse_string_list(struct string_list *list, const char *arg)
+static void parse_string_list(struct string_list *list, const char *arg)
 {
 	if (!strcmp(arg, "-"))
 		return;
@@ -15,14 +15,14 @@ void parse_string_list(struct string_list *list, const char *arg)
 	(void)string_list_split(list, arg, ':', -1);
 }
 
-void write_list(const struct string_list *list)
+static void write_list(const struct string_list *list)
 {
 	int i;
 	for (i = 0; i < list->nr; i++)
 		printf("[%d]: \"%s\"\n", i, list->items[i].string);
 }
 
-void write_list_compact(const struct string_list *list)
+static void write_list_compact(const struct string_list *list)
 {
 	int i;
 	if (!list->nr)
@@ -35,7 +35,7 @@ void write_list_compact(const struct string_list *list)
 	}
 }
 
-int prefix_cb(struct string_list_item *item, void *cb_data)
+static int prefix_cb(struct string_list_item *item, void *cb_data)
 {
 	const char *prefix = (const char *)cb_data;
 	return !prefixcmp(item->string, prefix);
-- 
1.7.12

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-09-20 20:46 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15 16:18 [PATCH] test-string-list.c: Fix some sparse warnings Ramsay Jones
2012-09-15 20:52 ` Junio C Hamano
2012-09-15 21:10 ` [PATCH 1/7] builtin/notes.c: mark file-scope functions as static Junio C Hamano
2012-09-15 21:10   ` [PATCH 2/7] commit.c: " Junio C Hamano
2012-09-15 21:10   ` [PATCH 3/7] diff.c: mark private file-scope symbols " Junio C Hamano
2012-09-15 21:10   ` [PATCH 4/7] graph.c: " Junio C Hamano
2012-09-15 21:10   ` [PATCH 5/7] grep.c: " Junio C Hamano
2012-09-19 18:02     ` Ramsay Jones
2012-09-19 20:46       ` Junio C Hamano
2012-09-20 20:43         ` Ramsay Jones
2012-09-15 21:10   ` [PATCH 6/7] rerere.c: " Junio C Hamano
2012-09-15 21:10   ` [PATCH 7/7] notes.c: " Junio C Hamano
2012-09-17  8:15 ` [PATCH] test-string-list.c: Fix some sparse warnings Michael Haggerty
2012-09-19 19:07   ` Ramsay Jones
2012-09-20  7:13     ` Michael Haggerty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).