mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-23 03:19:03 +00:00
utils: Move git__str[n]tolower
This commit is contained in:
parent
128d37316b
commit
0da2c70067
14
src/config.c
14
src/config.c
@ -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 {
|
|||||||
git_vector backends;
|
git_vector backends;
|
||||||
};
|
};
|
||||||
|
|
||||||
void git__strtolower(char *str);
|
|
||||||
void git__strntolower(char *str, int len);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
14
src/util.c
14
src/util.c
@ -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)
|
|||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user