git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] submodule-config: use explicit empty string instead of strbuf in config_from()

From
René Scharfe <l.s.r@web.de>
Date
Jul 19, 2016, 19:05 UTC
Message-ID
<578E7A07.8080006@web.de>

Use a string constant instead of an empty strbuf to shorten the code and make it easier to read.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
... unless someone can come up with a suitable non-empty string to feed
to git_config_from_mem() as its name parameter.
 submodule-config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/submodule-config.c b/submodule-config.c
index db1847f..44eb162 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -397,7 +397,6 @@ static const struct submodule *config_from(struct submodule_cache *cache,
 		const unsigned char *commit_sha1, const char *key,
 		enum lookup_type lookup_type)
 {
-	struct strbuf rev = STRBUF_INIT;
 	unsigned long config_size;
 	char *config;
 	unsigned char sha1[20];
@@ -448,7 +447,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,
 	parameter.commit_sha1 = commit_sha1;
 	parameter.gitmodules_sha1 = sha1;
 	parameter.overwrite = 0;
-	git_config_from_mem(parse_config, "submodule-blob", rev.buf,
+	git_config_from_mem(parse_config, "submodule-blob", "",
 			config, config_size, &parameter);
 	free(config);
 
-- 
2.9.2
Next: Junio C Hamano
Message 1 of 23 in “submodule-config: use explicit empty string instead of strbuf in config_from()”
  1. submodule-config: use explicit empty string instead of strbuf in config_from()René Scharfe, Jul 19, 2016
  2. Junio C HamanoJul 19, 2016
  3. Stefan BellerJul 19, 2016
  4. Heiko VoigtJul 20, 2016
  5. René ScharfeJul 21, 2016
  6. Heiko VoigtJul 25, 2016
  7. Junio C HamanoJul 25, 2016
  8. 2/2 submodule-config: combine error checking if clausesHeiko Voigt, Jul 26, 2016
  9. Stefan BellerJul 26, 2016
  10. 1/2 fix passing a name for config from submodulesHeiko Voigt, Jul 26, 2016
  11. Stefan BellerJul 26, 2016
  12. Junio C HamanoJul 26, 2016
  13. 1/3 submodule-config: passing name reference for .gitmodule blobsHeiko Voigt, Jul 28, 2016
  14. Stefan BellerJul 28, 2016
  15. 2/3 submodule-config: combine early return code into one gotoHeiko Voigt, Jul 28, 2016
  16. 3/3 submodule-config: fix test binary crashing when no arguments givenHeiko Voigt, Jul 28, 2016
  17. Heiko VoigtJul 28, 2016
  18. document how to reference previous commitsHeiko Voigt, Jul 28, 2016
  19. Junio C HamanoJul 28, 2016
  20. Stefan BellerJul 28, 2016
  21. Heiko VoigtAug 17, 2016
  22. Junio C HamanoAug 17, 2016
  23. Junio C HamanoJul 28, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.