summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-01-23 22:14:04 +0100
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-01-23 22:14:04 +0100
commita9fe8ae0ee1ddcc289fad53f1a671f02a3e9a88f (patch)
tree0ccd720cf7f11f080703ee7eaca7ab3225b386c7
parent19313a76b66c7af027f21340d7055dd9ba7dcd0c (diff)
downloadlibgit2-a9fe8ae0ee1ddcc289fad53f1a671f02a3e9a88f.tar.gz
config: don't use 'section "subsection"' internal form on config_set
This had been left over from a time when I believed what the git documentation had to say about case-sensitivity. The rest of the code doesn't recognize this form and we hadn't noticed because most tests don't try to get a recently-set variable but free and reload the configuration, causing the right format to be used.
-rw-r--r--src/config_file.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 2374b383c..481c593f4 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -230,23 +230,13 @@ static char *interiorize_section(const char *orig)
if (last_dot == dot)
return git__strndup(orig, dot - orig);
- section = git__malloc(len + 4);
+ section = git__strndup(orig, len);
if (section == NULL)
return NULL;
- memset(section, 0x0, len + 4);
ret = section;
len = dot - orig;
- memcpy(section, orig, len);
- section += len;
- len = strlen(" \"");
- memcpy(section, " \"", len);
- section += len;
- len = last_dot - dot - 1;
- memcpy(section, dot + 1, len);
- section += len;
- *section = '"';
-
+ git__strntolower(section, len);
return ret;
}