summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/strbuf.c b/strbuf.c
index 1170d01c43..ee96dcfb81 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,22 +1,22 @@
#include "cache.h"
#include "refs.h"
-int prefixcmp(const char *str, const char *prefix)
+int starts_with(const char *str, const char *prefix)
{
for (; ; str++, prefix++)
if (!*prefix)
- return 0;
+ return 1;
else if (*str != *prefix)
- return (unsigned char)*prefix - (unsigned char)*str;
+ return 0;
}
-int suffixcmp(const char *str, const char *suffix)
+int ends_with(const char *str, const char *suffix)
{
int len = strlen(str), suflen = strlen(suffix);
if (len < suflen)
- return -1;
+ return 0;
else
- return strcmp(str + len - suflen, suffix);
+ return !strcmp(str + len - suflen, suffix);
}
/*