From: Jeff King Date: Thu, 9 Jun 2011 15:55:09 +0000 (-0400) Subject: config: use strbuf_split_str instead of a temporary strbuf X-Git-Tag: v1.7.7-rc0~91^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f77bccaeba7a4c542e9b89d144af74bddd36fd08;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/config.c b/config.c index 9939f65d9..44b2c93b2 100644 --- a/config.c +++ b/config.c @@ -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] == '=')