mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-24 07:03:21 +00:00
Add strtolower and strntolower functions
As parts of variable names are case-sensitive, we need these functions. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
This commit is contained in:
parent
df22949a35
commit
923fe4557f
15
src/config.c
15
src/config.c
@ -70,6 +70,20 @@ static git_cvar *cvar_list_find(git_cvar *start, const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void strntolower(char *str, int len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
str[len] = tolower(str[len]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void strtolower(char *str)
|
||||||
|
{
|
||||||
|
strntolower(str, strlen(str));
|
||||||
|
}
|
||||||
|
|
||||||
int git_config_open(git_config **cfg_out, const char *path)
|
int git_config_open(git_config **cfg_out, const char *path)
|
||||||
{
|
{
|
||||||
git_config *cfg;
|
git_config *cfg;
|
||||||
@ -544,6 +558,7 @@ static int parse_section_header(git_config *cfg, char **section_out, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
name[name_length] = 0;
|
name[name_length] = 0;
|
||||||
|
strtolower(name);
|
||||||
*section_out = name;
|
*section_out = name;
|
||||||
return GIT_SUCCESS;
|
return GIT_SUCCESS;
|
||||||
|
|
||||||
|
@ -30,4 +30,7 @@ struct git_cvar {
|
|||||||
#define CVAR_LIST_FOREACH(start, iter) \
|
#define CVAR_LIST_FOREACH(start, iter) \
|
||||||
for ((iter) = (start); (iter) != NULL; (iter) = (iter)->next)
|
for ((iter) = (start); (iter) != NULL; (iter) = (iter)->next)
|
||||||
|
|
||||||
|
void strtolower(char *str);
|
||||||
|
void strntolower(char *str, int len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user