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

[PATCH 6/8] config: drop unused parameter from maybe_remove_section()

From
Jeff King <peff@peff.net>
Date
Jan 24, 2019, 13:12 UTC
Message-ID
<20190124131232.GF22398@sigill.intra.peff.net>
In-Reply-To
<20190124131104.GA24017@sigill.intra.peff.net>

We don't need the contents buffer to drop a section; the parse information in the config_store_data parameter is enough for our logic.

Signed-off-by: Jeff King <peff@peff.net>
---
 config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/config.c b/config.c
index ff521eb27a..24ad1a9854 100644
--- a/config.c
+++ b/config.c
@@ -2565,7 +2565,6 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
  * entry (which all are to be removed).
  */
 static void maybe_remove_section(struct config_store_data *store,
-				 const char *contents,
 				 size_t *begin_offset, size_t *end_offset,
 				 int *seen_ptr)
 {
@@ -2850,7 +2849,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
 				replace_end = store.parsed[j].end;
 				copy_end = store.parsed[j].begin;
 				if (!value)
-					maybe_remove_section(&store, contents,
+					maybe_remove_section(&store,
 							     &copy_end,
 							     &replace_end, &i);
 				/*
-- 
2.20.1.842.g8986705066
Previous: Derrick StoleeNext: Jeff King
Message 8 of 13 in “drop some unused parameters”
  1. 0/9 drop some unused parametersJeff King, Jan 24, 2019
  2. 1/8 match-trees: drop unused path parameter from score functionsJeff King, Jan 24, 2019
  3. 2/8 apply: drop unused "def" parameter from find_name_gnu()Jeff King, Jan 24, 2019
  4. 3/8 create_bundle(): drop unused "header" parameterJeff King, Jan 24, 2019
  5. 4/8 column: drop unused "opts" parameter in item_length()Jeff King, Jan 24, 2019
  6. 5/8 show_date_relative(): drop unused "tz" parameterJeff King, Jan 24, 2019
  7. Derrick StoleeJan 24, 2019
  8. 6/8 config: drop unused parameter from maybe_remove_section()Jeff King, Jan 24, 2019
  9. 7/8 convert: drop len parameter from conversion checksJeff King, Jan 24, 2019
  10. 8/8 convert: drop path parameter from actual conversion functionsJeff King, Jan 24, 2019
  11. Derrick StoleeJan 24, 2019
  12. Junio C HamanoJan 24, 2019
  13. brian m. carlsonJan 25, 2019

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.