Skip to content

Commit 666c90b

Browse files
chriscoolgitster
authored andcommitted
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>
1 parent 5955654 commit 666c90b

2 files changed

Lines changed: 0 additions & 20 deletions

File tree

git-compat-util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,7 @@ extern void set_error_routine(void (*routine)(const char *err, va_list params));
351351
extern void set_die_is_recursing_routine(int (*routine)(void));
352352

353353
extern int starts_with(const char *str, const char *prefix);
354-
extern int prefixcmp(const char *str, const char *prefix);
355354
extern int ends_with(const char *str, const char *suffix);
356-
extern int suffixcmp(const char *str, const char *suffix);
357355

358356
static inline const char *skip_prefix(const char *str, const char *prefix)
359357
{

strbuf.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ int starts_with(const char *str, const char *prefix)
1010
return 0;
1111
}
1212

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-
2213
int ends_with(const char *str, const char *suffix)
2314
{
2415
int len = strlen(str), suflen = strlen(suffix);
@@ -28,15 +19,6 @@ int ends_with(const char *str, const char *suffix)
2819
return !strcmp(str + len - suflen, suffix);
2920
}
3021

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-
4022
/*
4123
* Used as the default ->buf value, so that people can always assume
4224
* buf is non NULL and ->buf is NUL terminated even for a freshly

0 commit comments

Comments
 (0)