Skip to content

Commit fa82037

Browse files
committed
Merge branch 'rs/more-starts-with'
* rs/more-starts-with: Use starts_with() for C strings instead of memcmp()
2 parents 9ba6640 + 50e19a8 commit fa82037

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

builtin/for-each-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int verify_format(const char *format)
193193
at = parse_atom(sp + 2, ep);
194194
cp = ep + 1;
195195

196-
if (!memcmp(used_atom[at], "color:", 6))
196+
if (starts_with(used_atom[at], "color:"))
197197
need_color_reset_at_eol = !!strcmp(used_atom[at], color_reset);
198198
}
199199
return 0;

fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ static void filter_refs(struct fetch_pack_args *args,
507507
int keep = 0;
508508
next = ref->next;
509509

510-
if (!memcmp(ref->name, "refs/", 5) &&
510+
if (starts_with(ref->name, "refs/") &&
511511
check_refname_format(ref->name, 0))
512512
; /* trash */
513513
else {

remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ static int match_explicit(struct ref *src, struct ref *dst,
11941194
case 1:
11951195
break;
11961196
case 0:
1197-
if (!memcmp(dst_value, "refs/", 5))
1197+
if (starts_with(dst_value, "refs/"))
11981198
matched_dst = make_linked_ref(dst_value, dst_tail);
11991199
else if (is_null_sha1(matched_src->new_sha1))
12001200
error("unable to delete '%s': remote ref does not exist",

0 commit comments

Comments
 (0)