diff options
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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); } /* |