X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=strbuf.c;h=bc3a0802ea7e7b1743602972de182391b4bf0b3f;hb=c5ce1836719dc77e3c8495206653037cb5c4e511;hp=af9130e52d877bc49748dd5e2db9c5912ab08837;hpb=361df5df77255321b2ca409d892b4c24b7b0441d;p=git.git diff --git a/strbuf.c b/strbuf.c index af9130e52..bc3a0802e 100644 --- a/strbuf.c +++ b/strbuf.c @@ -10,6 +10,15 @@ int prefixcmp(const char *str, const char *prefix) return (unsigned char)*prefix - (unsigned char)*str; } +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 @@ -91,13 +100,6 @@ void strbuf_ltrim(struct strbuf *sb) sb->buf[sb->len] = '\0'; } -void strbuf_tolower(struct strbuf *sb) -{ - int i; - for (i = 0; i < sb->len; i++) - sb->buf[i] = tolower(sb->buf[i]); -} - struct strbuf **strbuf_split(const struct strbuf *sb, int delim) { int alloc = 2, pos = 0;