summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-03-30 16:22:31 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-03-31 15:05:12 +0200
commitd7354d70b0cc56f16b3dece3bf271eaffaeaf029 (patch)
tree232624b5db5bd93719300f0bb609291719f6a0a2 /src/config.c
parent0bbaf9aaef875daf6e5db6bec143b7b84d906524 (diff)
downloadlibgit2-d7354d70b0cc56f16b3dece3bf271eaffaeaf029.tar.gz
build_varname: lowercase the variable name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c
index 71a173f47..41c4d3a8e 100644
--- a/src/config.c
+++ b/src/config.c
@@ -686,9 +686,10 @@ static int config_parse(git_config *cfg_file)
}
/*
- * Gives $section.$name back, using only name_len chars from the name,
- * which is useful so we don't have to copy the variable name twice.
- * Don't forget to free the memory you get.
+ * Returns $section.$name, using only name_len chars from the name,
+ * which is useful so we don't have to copy the variable name
+ * twice. The name of the variable is set to lowercase.
+ *Don't forget to free the buffer.
*/
static char *build_varname(const char *section, const char *name, int name_len)
{
@@ -703,6 +704,9 @@ static char *build_varname(const char *section, const char *name, int name_len)
return NULL;
ret = snprintf(varname, total_len, "%s.%s", section, name);
+ if(ret >= 0){
+ strtolower(varname + section_len + 1);
+ }
return varname;
}