strbuf: remove prefixcmp() and suffixcmp()
As starts_with() and ends_with() have been used to replace prefixcmp() and suffixcmp() respectively, we can now remove them. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Dec 1, 2013 at 08:49 UTC
666c90b6290dae0f4d3672a2b0caf6dea67dd1e3
2 files changed
-20
git-compat-util.h
-2
@@ -351,9 +351,7 @@ extern void set_error_routine(void (*routine)(const char *err, va_list params));
351
extern void set_die_is_recursing_routine(int (*routine)(void));
352
353
extern int starts_with(const char *str, const char *prefix);
354
-extern int prefixcmp(const char *str, const char *prefix);
354
extern int ends_with(const char *str, const char *suffix);
356
-extern int suffixcmp(const char *str, const char *suffix);
355
356
static inline const char *skip_prefix(const char *str, const char *prefix)
357
{
strbuf.c
-18
@@ -10,15 +10,6 @@ int starts_with(const char *str, const char *prefix)
10
return 0;
11
}
12
13
-int prefixcmp(const char *str, const char *prefix)
14
-{
15
- for (; ; str++, prefix++)
16
- if (!*prefix)
17
- return 0;
18
- else if (*str != *prefix)
19
- return (unsigned char)*prefix - (unsigned char)*str;
20
-}
21
-
13
int ends_with(const char *str, const char *suffix)
14
{
15
int len = strlen(str), suflen = strlen(suffix);
@@ -28,15 +19,6 @@ int ends_with(const char *str, const char *suffix)
19
return !strcmp(str + len - suflen, suffix);
20
}
21
31
-int suffixcmp(const char *str, const char *suffix)
32
-{
33
- int len = strlen(str), suflen = strlen(suffix);
34
- if (len < suflen)
35
- return -1;
36
- else
37
- return strcmp(str + len - suflen, suffix);
38
-}
39
-
22
/*
23
* Used as the default ->buf value, so that people can always assume
24
* buf is non NULL and ->buf is NUL terminated even for a freshly