Merge branch 'rs/more-starts-with'
authorJunio C Hamano <gitster@pobox.com>
Fri, 20 Jun 2014 20:12:13 +0000 (13:12 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Jun 2014 20:12:14 +0000 (13:12 -0700)
* rs/more-starts-with:
Use starts_with() for C strings instead of memcmp()

1  2 
remote.c
diff --combined remote.c
index 0e9459cc0675d2f232b1c1fda62080d04aa88ec5,0f6ef36b7d1f7e76eb3a4a742f2ba0f234d20d15..ae040432037f7463233c5add8257b17ace365b23
+++ b/remote.c
@@@ -523,7 -523,7 +523,7 @@@ static void free_refspecs(struct refspe
  static struct refspec *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify)
  {
        int i;
 -      struct refspec *rs = xcalloc(sizeof(*rs), nr_refspec);
 +      struct refspec *rs = xcalloc(nr_refspec, sizeof(*rs));
  
        for (i = 0; i < nr_refspec; i++) {
                size_t llen;
@@@ -1194,7 -1194,7 +1194,7 @@@ static int match_explicit(struct ref *s
        case 1:
                break;
        case 0:
-               if (!memcmp(dst_value, "refs/", 5))
+               if (starts_with(dst_value, "refs/"))
                        matched_dst = make_linked_ref(dst_value, dst_tail);
                else if (is_null_sha1(matched_src->new_sha1))
                        error("unable to delete '%s': remote ref does not exist",