diff options
author | Jeff King <peff@peff.net> | 2011-06-09 11:55:09 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-06-22 11:24:51 -0700 |
commit | f77bccaeba7a4c542e9b89d144af74bddd36fd08 (patch) | |
tree | 80636c7d0b50ba929bce8076fa92a66eec4a9d4e /config.c | |
parent | 2f1d9e2b93e1b7fbfcfa59331db89dd6c76a3505 (diff) | |
download | git-f77bccaeba7a4c542e9b89d144af74bddd36fd08.tar.gz |
config: use strbuf_split_str instead of a temporary strbuf
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>
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -42,10 +42,8 @@ void git_config_push_parameter(const char *text) 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] == '=') |