summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharlie Somerville <charlie@charlie.bz>2017-12-20 15:24:30 +1100
committerCharlie Somerville <charlie@charlie.bz>2017-12-20 15:27:09 +1100
commit72fbf05ceb088e6592b44d7656ed2bca14506696 (patch)
treeef2ec7f507e7757eb4c38a92a4048de61c172482 /src
parent137226116e9a09ee02102798e1f9b5457da26076 (diff)
downloadlibgit2-72fbf05ceb088e6592b44d7656ed2bca14506696.tar.gz
trailer: use git__prefixcmp instead of starts_with
Diffstat (limited to 'src')
-rw-r--r--src/trailer.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/trailer.c b/src/trailer.c
index cc9767922..c70ce031e 100644
--- a/src/trailer.c
+++ b/src/trailer.c
@@ -65,18 +65,6 @@ static int last_line(const char *buf, size_t len)
return 0;
}
-static bool starts_with(const char *str, const char *prefix)
-{
- size_t str_len = strlen(str);
- size_t prefix_len = strlen(prefix);
-
- if (prefix_len > str_len) {
- return false;
- }
-
- return memcmp(str, prefix, prefix_len) == 0;
-}
-
/*
* If the given line is of the form
* "<token><optional whitespace><separator>..." or "<separator>...", return the
@@ -136,7 +124,7 @@ static int ignore_non_trailer(const char *buf, size_t len)
if (!boc)
boc = bol;
/* otherwise, it is just continuing */
- } else if (starts_with(buf + bol, "Conflicts:\n")) {
+ } else if (git__prefixcmp(buf + bol, "Conflicts:\n") == 0) {
in_old_conflicts_block = 1;
if (!boc)
boc = bol;
@@ -161,7 +149,7 @@ static int find_patch_start(const char *str)
const char *s;
for (s = str; *s; s = next_line(s)) {
- if (starts_with(s, "---"))
+ if (git__prefixcmp(s, "---") == 0)
return s - str;
}
@@ -227,7 +215,7 @@ static int find_trailer_start(const char *buf, size_t len)
only_spaces = 0;
for (p = git_generated_prefixes; *p; p++) {
- if (starts_with(bol, *p)) {
+ if (git__prefixcmp(bol, *p) == 0) {
trailer_lines++;
possible_continuation_lines = 0;
recognized_prefix = 1;