From: Junio C Hamano Date: Fri, 20 Jun 2014 20:12:13 +0000 (-0700) Subject: Merge branch 'rs/more-starts-with' X-Git-Tag: v2.1.0-rc0~96 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/fa8203741e37d9d37098bfe260d7040e70f11023?ds=inline;hp=-c Merge branch 'rs/more-starts-with' * rs/more-starts-with: Use starts_with() for C strings instead of memcmp() --- fa8203741e37d9d37098bfe260d7040e70f11023 diff --combined remote.c index 0e9459cc06,0f6ef36b7d..ae04043203 --- a/remote.c +++ 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",