summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2f1d9e2)
raw | patch | inline | side by side (parent: 2f1d9e2)
author | Jeff King <peff@peff.net> | |
Thu, 9 Jun 2011 15:55:09 +0000 (11:55 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 22 Jun 2011 18:24:51 +0000 (11:24 -0700) |
This saves an allocation and copy, and also fixes a minor
memory leak.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
memory leak.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c | patch | blob | history |
diff --git a/config.c b/config.c
index 9939f65d9e9dfbb7b1f40749a1aaf0850e069350..44b2c93b2425a4ed5ca3a2cf8f042aca8e275c56 100644 (file)
--- a/config.c
+++ b/config.c
static int git_config_parse_parameter(const char *text,
config_fn_t fn, void *data)
{
- struct strbuf tmp = STRBUF_INIT;
struct strbuf **pair;
- strbuf_addstr(&tmp, text);
- pair = strbuf_split_max(&tmp, '=', 2);
+ pair = strbuf_split_str(text, '=', 2);
if (!pair[0])
return error("bogus config parameter: %s", text);
if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=')