git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] merge-recursive: use STRING_LIST_INIT_NODUP
@ 2016-08-05 20:42 René Scharfe
  2016-08-07  8:51 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2016-08-05 20:42 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] merge-recursive: use STRING_LIST_INIT_NODUP
  2016-08-05 20:42 [PATCH] merge-recursive: use STRING_LIST_INIT_NODUP René Scharfe
@ 2016-08-07  8:51 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2016-08-07  8:51 UTC (permalink / raw)
  To: René Scharfe; +Cc: Git List, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

Hi René,

On Fri, 5 Aug 2016, René Scharfe wrote:

> 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.

Thank you! I guess I never updated the code after the _INIT* macros were
introduced.

The change is good, of course.

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-07  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05 20:42 [PATCH] merge-recursive: use STRING_LIST_INIT_NODUP René Scharfe
2016-08-07  8:51 ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).