#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);
}
/*