Commit 0da2c700 by Vicent Marti

utils: Move git__str[n]tolower

parent 128d3731
...@@ -37,20 +37,6 @@ typedef struct { ...@@ -37,20 +37,6 @@ typedef struct {
int priority; int priority;
} backend_internal; } 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) int git_config_open_bare(git_config **out, const char *path)
{ {
git_config_backend *backend = NULL; git_config_backend *backend = NULL;
......
...@@ -9,7 +9,4 @@ struct git_config { ...@@ -9,7 +9,4 @@ struct git_config {
git_vector backends; git_vector backends;
}; };
void git__strtolower(char *str);
void git__strntolower(char *str, int len);
#endif #endif
...@@ -104,6 +104,20 @@ int git__fmt(char *buf, size_t buf_sz, const char *fmt, ...) ...@@ -104,6 +104,20 @@ int git__fmt(char *buf, size_t buf_sz, const char *fmt, ...)
return r; 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) int git__prefixcmp(const char *str, const char *prefix)
{ {
for (;;) { for (;;) {
......
...@@ -142,6 +142,9 @@ GIT_INLINE(int) git__is_sizet(git_off_t p) ...@@ -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(char *output, char *src, char *delimit);
extern char *git__strtok_keep(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 STRLEN(str) (sizeof(str) - 1)
#define GIT_OID_LINE_LENGTH(header) (STRLEN(header) + 1 + GIT_OID_HEXSZ + 1) #define GIT_OID_LINE_LENGTH(header) (STRLEN(header) + 1 + GIT_OID_HEXSZ + 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment