Merge branch 'jk/refs-c-squelch-gcc'
authorJunio C Hamano <gitster@pobox.com>
Wed, 30 Oct 2013 19:11:03 +0000 (12:11 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Oct 2013 19:11:04 +0000 (12:11 -0700)
* jk/refs-c-squelch-gcc:
silence gcc array-bounds warning

refs.c
diff --git a/refs.c b/refs.c
index 3710748ab88d8fa4639c3a0a436ca0e2b0c25552..0c0e963532a6dcf2f9c062b371d40a2cd10571c3 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -3376,7 +3376,7 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
                size_t total_len = 0;
 
                /* the rule list is NULL terminated, count them first */
-               for (; ref_rev_parse_rules[nr_rules]; nr_rules++)
+               for (nr_rules = 0; ref_rev_parse_rules[nr_rules]; nr_rules++)
                        /* no +1 because strlen("%s") < strlen("%.*s") */
                        total_len += strlen(ref_rev_parse_rules[nr_rules]);