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>

Jeff King committed Jun 9, 2011 at 11:55 UTC f77bccaeba7a4c542e9b89d144af74bddd36fd08
1 file changed +1 -3
config.c
+1 -3
@@ -42,10 +42,8 @@ void git_config_push_parameter(const char *text)
42 static int git_config_parse_parameter(const char *text,
43 config_fn_t fn, void *data)
44 {
45 - struct strbuf tmp = STRBUF_INIT;
45 struct strbuf **pair;
47 - strbuf_addstr(&tmp, text);
48 - pair = strbuf_split_max(&tmp, '=', 2);
46 + pair = strbuf_split_str(text, '=', 2);
47 if (!pair[0])
48 return error("bogus config parameter: %s", text);
49 if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=')