X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=strbuf.c;h=bc3a0802ea7e7b1743602972de182391b4bf0b3f;hb=da288e25d9e10b746cf3b311cb4503d1810cde37;hp=67448b7b07aa9d07b0c8cc250e3e0fad64c8fb5e;hpb=5fc9df08b564aa9d11265ad591f9ef104695ce2b;p=git.git diff --git a/strbuf.c b/strbuf.c index 67448b7b0..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