Commit 0da2c70067135ffb095f951b30cb085db1aeccce

Vicent Marti 2011-05-17T15:09:30

utils: Move git__str[n]tolower

diff --git a/src/config.c b/src/config.c
index 234c530..cd0a73c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -37,20 +37,6 @@ typedef struct {
 	int priority;
 } backend_internal;
 
-void git__strntolower(char *str, int len)
-{
-	int i;
-
-	for (i = 0; i < len; ++i) {
-		str[i] = tolower(str[i]);
-	}
-}
-
-void git__strtolower(char *str)
-{
-	git__strntolower(str, strlen(str));
-}
-
 int git_config_open_bare(git_config **out, const char *path)
 {
 	git_config_backend *backend = NULL;
diff --git a/src/config.h b/src/config.h
index e786e8a..a811fd8 100644
--- a/src/config.h
+++ b/src/config.h
@@ -9,7 +9,4 @@ struct git_config {
 	git_vector backends;
 };
 
-void git__strtolower(char *str);
-void git__strntolower(char *str, int len);
-
 #endif
diff --git a/src/util.c b/src/util.c
index 55a7ab2..9499cea 100644
--- a/src/util.c
+++ b/src/util.c
@@ -104,6 +104,20 @@ int git__fmt(char *buf, size_t buf_sz, const char *fmt, ...)
 	return r;
 }
 
+void git__strntolower(char *str, int len)
+{
+	int i;
+
+	for (i = 0; i < len; ++i) {
+		str[i] = tolower(str[i]);
+	}
+}
+
+void git__strtolower(char *str)
+{
+	git__strntolower(str, strlen(str));
+}
+
 int git__prefixcmp(const char *str, const char *prefix)
 {
 	for (;;) {
diff --git a/src/util.h b/src/util.h
index ff6e67f..e5a2ebe 100644
--- a/src/util.h
+++ b/src/util.h
@@ -142,6 +142,9 @@ GIT_INLINE(int) git__is_sizet(git_off_t p)
 extern char *git__strtok(char *output, char *src, char *delimit);
 extern char *git__strtok_keep(char *output, char *src, char *delimit);
 
+extern void git__strntolower(char *str, int len);
+extern void git__strtolower(char *str);
+
 #define STRLEN(str) (sizeof(str) - 1)
 
 #define GIT_OID_LINE_LENGTH(header) (STRLEN(header) + 1 + GIT_OID_HEXSZ + 1)