Thread (46 messages) 46 messages, 4 authors, 2022-04-04

[PATCH 5/6] strbuf: remove unused istarts_with() function

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-11-19 12:46:41
Subsystem: the rest · Maintainer: Linus Torvalds

This function was added in 66b8af3e124 (strbuf: add a case insensitive
starts_with(), 2018-03-09) for use with code added in
2f0c4a362c5 (utf8: teach same_encoding() alternative UTF encoding
names, 2018-04-15).

That use got rewritten in ed283588330 (convert: use skip_iprefix() in
validate_encoding(), 2019-11-08) to use skip_iprefix() instead.

It's arguably slightly odd to have a skip_prefix() and iskip_prefix(),
but not both variants when it comes to starts_with(), but this is easy
enough to resurrect should we ever need it, so let's drop it for now.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 git-compat-util.h | 1 -
 strbuf.c          | 9 ---------
 2 files changed, 10 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index d70ce142861..7117024a28b 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -512,7 +512,6 @@ report_fn get_warn_routine(void);
 void set_die_is_recursing_routine(int (*routine)(void));
 
 int starts_with(const char *str, const char *prefix);
-int istarts_with(const char *str, const char *prefix);
 
 /*
  * If the string "str" begins with the string found in "prefix", return 1.
diff --git a/strbuf.c b/strbuf.c
index b22e9816559..1b52e3c8250 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -12,15 +12,6 @@ int starts_with(const char *str, const char *prefix)
 			return 0;
 }
 
-int istarts_with(const char *str, const char *prefix)
-{
-	for (; ; str++, prefix++)
-		if (!*prefix)
-			return 1;
-		else if (tolower(*str) != tolower(*prefix))
-			return 0;
-}
-
 int skip_to_optional_arg_default(const char *str, const char *prefix,
 				 const char **arg, const char *def)
 {
-- 
2.34.0.817.gb03b3d32691
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help