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

[PATCH] merge-recursive: use STRING_LIST_INIT_NODUP

From
René Scharfe <l.s.r@web.de>
Date
Aug 5, 2016, 20:42 UTC
Message-ID
<57A4FA24.4050505@web.de>

Initialize a string_list right when it's defined. That's shorter, saves a function call and makes it more obvious that we're using the NODUP variant here.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 merge-recursive.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index a4a1195..97e6737 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -409,7 +409,7 @@ static void record_df_conflict_files(struct merge_options *o,
 	 * and the file need to be present, then the D/F file will be
 	 * reinstated with a new unique name at the time it is processed.
 	 */
-	struct string_list df_sorted_entries;
+	struct string_list df_sorted_entries = STRING_LIST_INIT_NODUP;
 	const char *last_file = NULL;
 	int last_len = 0;
 	int i;
@@ -422,7 +422,6 @@ static void record_df_conflict_files(struct merge_options *o,
 		return;
 
 	/* Ensure D/F conflicts are adjacent in the entries list. */
-	memset(&df_sorted_entries, 0, sizeof(struct string_list));
 	for (i = 0; i < entries->nr; i++) {
 		struct string_list_item *next = &entries->items[i];
 		string_list_append(&df_sorted_entries, next->string)->util =
-- 
2.9.2
Next: Johannes Schindelin
Message 1 of 2 in “merge-recursive: use STRING_LIST_INIT_NODUP”
  1. merge-recursive: use STRING_LIST_INIT_NODUPRené Scharfe, Aug 5, 2016
  2. Johannes SchindelinAug 7, 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.