No need for a strbuf, when all we use it for, is duplicating a string.

Signed-off-by: Stefan Beller <sbel...@google.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to