mirror of
https://github.com/git/git.git
synced 2024-06-10 11:06:09 +02:00
fetch: convert strncmp() with strlen() to starts_with()
Using strncmp() and strlen() to check whether a string starts with another one requires repeating the prefix candidate. Use starts_with() instead, which reduces repetition and is more readable. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3c2a3fdc38
commit
87bd7fbb9c
|
@ -448,9 +448,8 @@ static void filter_prefetch_refspec(struct refspec *rs)
|
|||
continue;
|
||||
if (!rs->items[i].dst ||
|
||||
(rs->items[i].src &&
|
||||
!strncmp(rs->items[i].src,
|
||||
ref_namespace[NAMESPACE_TAGS].ref,
|
||||
strlen(ref_namespace[NAMESPACE_TAGS].ref)))) {
|
||||
starts_with(rs->items[i].src,
|
||||
ref_namespace[NAMESPACE_TAGS].ref))) {
|
||||
int j;
|
||||
|
||||
free(rs->items[i].src);
|
||||
|
|
Loading…
Reference in New Issue