summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-07 23:18:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-07 23:18:28 (GMT)
commite3f118594683b075d70fb479a81613f614a7b1f1 (patch)
treeac5d0413c27634940d2a73c77fab30ec7e250a43
parent2687ffdeb76816a1645a5c3e3c7aaf654cc923bc (diff)
parent666c90b6290dae0f4d3672a2b0caf6dea67dd1e3 (diff)
downloadgit-e3f118594683b075d70fb479a81613f614a7b1f1.zip
git-e3f118594683b075d70fb479a81613f614a7b1f1.tar.gz
git-e3f118594683b075d70fb479a81613f614a7b1f1.tar.bz2
Merge branch 'cc/starts-n-ends-with-endgame'
prefixcmp/suffixcmp are gone.
-rw-r--r--builtin/push.c2
-rw-r--r--git-compat-util.h2
-rw-r--r--strbuf.c18
3 files changed, 1 insertions, 21 deletions
diff --git a/builtin/push.c b/builtin/push.c
index cd6c164..f8dfea4 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -58,7 +58,7 @@ static const char *map_refspec(const char *ref,
}
if (push_default == PUSH_DEFAULT_UPSTREAM &&
- !prefixcmp(matched->name, "refs/heads/")) {
+ starts_with(matched->name, "refs/heads/")) {
struct branch *branch = branch_get(matched->name + 11);
if (branch->merge_nr == 1 && branch->merge[0]->src) {
struct strbuf buf = STRBUF_INIT;
diff --git a/git-compat-util.h b/git-compat-util.h
index 614a5e9..082eb0d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -351,9 +351,7 @@ extern void set_error_routine(void (*routine)(const char *err, va_list params));
extern void set_die_is_recursing_routine(int (*routine)(void));
extern int starts_with(const char *str, const char *prefix);
-extern int prefixcmp(const char *str, const char *prefix);
extern int ends_with(const char *str, const char *suffix);
-extern int suffixcmp(const char *str, const char *suffix);
static inline const char *skip_prefix(const char *str, const char *prefix)
{
diff --git a/strbuf.c b/strbuf.c
index 83caf4a..ee96dcf 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -10,15 +10,6 @@ int starts_with(const char *str, const char *prefix)
return 0;
}
-int prefixcmp(const char *str, const char *prefix)
-{
- for (; ; str++, prefix++)
- if (!*prefix)
- return 0;
- else if (*str != *prefix)
- return (unsigned char)*prefix - (unsigned char)*str;
-}
-
int ends_with(const char *str, const char *suffix)
{
int len = strlen(str), suflen = strlen(suffix);
@@ -28,15 +19,6 @@ int ends_with(const char *str, const char *suffix)
return !strcmp(str + len - suflen, suffix);
}
-int suffixcmp(const char *str, const char *suffix)
-{
- int len = strlen(str), suflen = strlen(suffix);
- if (len < suflen)
- return -1;
- else
- return strcmp(str + len - suflen, suffix);
-}
-
/*
* Used as the default ->buf value, so that people can always assume
* buf is non NULL and ->buf is NUL terminated even for a freshly