From: Stefan Beller Date: Thu, 04 Feb 2016 22:09:31 GMT Subject: [PATCHv8 4/9] submodule-config: slightly simplify lookup_or_create_by_name Message-ID: <1454623776-3347-5-git-send-email-sbeller@google.com> In-Reply-To: <1454623776-3347-1-git-send-email-sbeller@google.com> No need for a strbuf, when all we use it for, is duplicating a string. Signed-off-by: Stefan Beller --- submodule-config.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/submodule-config.c b/submodule-config.c index c08ee7f..e375730 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -165,7 +165,6 @@ static struct submodule *lookup_or_create_by_name(struct submodule_cache *cache, const unsigned char *gitmodules_sha1, const char *name) { struct submodule *submodule; - struct strbuf name_buf = STRBUF_INIT; submodule = cache_lookup_name(cache, gitmodules_sha1, name); if (submodule) @@ -173,9 +172,7 @@ static struct submodule *lookup_or_create_by_name(struct submodule_cache *cache, submodule = xmalloc(sizeof(*submodule)); - strbuf_addstr(&name_buf, name); - submodule->name = strbuf_detach(&name_buf, NULL); - + submodule->name = xstrdup(name); submodule->path = NULL; submodule->url = NULL; submodule->update = NULL; -- 2.7.0.rc0.41.gd102984.dirty