Skip to content

Commit

Permalink
test-string-list.c: Fix some sparse warnings
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramsay Jones authored and Junio C Hamano committed Sep 16, 2012
1 parent 5f0fc64 commit 6511987
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test-string-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
* 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;

(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)
Expand All @@ -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);
Expand Down

0 comments on commit 6511987

Please sign in to comment.