All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Phillip Wood <phillip.wood@dunelm.org.uk>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH 2/4] merge-ll: introduce LL_MERGE_OPTIONS_INIT
Date: Fri, 08 Mar 2024 14:14:28 +0000	[thread overview]
Message-ID: <4e05bc156bc93e86f3f2ac878c39596bec722a56.1709907270.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1684.git.1709907270.gitgitgadget@gmail.com>

From: Phillip Wood <phillip.wood@dunelm.org.uk>

Introduce a macro to initialize `struct ll_merge_options` in preparation
for the next commit that will add a new member that needs to be
initialized to a non-zero value.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 builtin/checkout.c | 3 +--
 merge-ll.c         | 2 +-
 merge-ll.h         | 2 ++
 merge-ort.c        | 2 +-
 merge-recursive.c  | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 067c2519334..6ded58bd95c 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -262,7 +262,7 @@ static int checkout_merged(int pos, const struct checkout *state,
 	mmbuffer_t result_buf;
 	struct object_id threeway[3];
 	unsigned mode = 0;
-	struct ll_merge_options ll_opts;
+	struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
 	int renormalize = 0;
 
 	memset(threeway, 0, sizeof(threeway));
@@ -284,7 +284,6 @@ static int checkout_merged(int pos, const struct checkout *state,
 	read_mmblob(&ours, &threeway[1]);
 	read_mmblob(&theirs, &threeway[2]);
 
-	memset(&ll_opts, 0, sizeof(ll_opts));
 	git_config_get_bool("merge.renormalize", &renormalize);
 	ll_opts.renormalize = renormalize;
 	merge_status = ll_merge(&result_buf, path, &ancestor, "base",
diff --git a/merge-ll.c b/merge-ll.c
index 61e0ae53981..6570707297d 100644
--- a/merge-ll.c
+++ b/merge-ll.c
@@ -401,7 +401,7 @@ enum ll_merge_result ll_merge(mmbuffer_t *result_buf,
 	     const struct ll_merge_options *opts)
 {
 	struct attr_check *check = load_merge_attributes();
-	static const struct ll_merge_options default_opts;
+	static const struct ll_merge_options default_opts = LL_MERGE_OPTIONS_INIT;
 	const char *ll_driver_name = NULL;
 	int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
 	const struct ll_merge_driver *driver;
diff --git a/merge-ll.h b/merge-ll.h
index e4a20e81a3a..af1ee36abdb 100644
--- a/merge-ll.h
+++ b/merge-ll.h
@@ -82,6 +82,8 @@ struct ll_merge_options {
 	long xdl_opts;
 };
 
+#define LL_MERGE_OPTIONS_INIT {0}
+
 enum ll_merge_result {
 	LL_MERGE_ERROR = -1,
 	LL_MERGE_OK = 0,
diff --git a/merge-ort.c b/merge-ort.c
index 8617babee41..4a02c3ecd99 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -1956,7 +1956,7 @@ static int merge_3way(struct merge_options *opt,
 		      mmbuffer_t *result_buf)
 {
 	mmfile_t orig, src1, src2;
-	struct ll_merge_options ll_opts = {0};
+	struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
 	char *base, *name1, *name2;
 	enum ll_merge_result merge_status;
 
diff --git a/merge-recursive.c b/merge-recursive.c
index a0c3e7a2d91..02b7b584f95 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1047,7 +1047,7 @@ static int merge_3way(struct merge_options *opt,
 		      const int extra_marker_size)
 {
 	mmfile_t orig, src1, src2;
-	struct ll_merge_options ll_opts = {0};
+	struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
 	char *base, *name1, *name2;
 	enum ll_merge_result merge_status;
 
-- 
gitgitgadget


  parent reply	other threads:[~2024-03-08 14:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 14:14 [PATCH 0/4] checkout: cleanup --conflict= Phillip Wood via GitGitGadget
2024-03-08 14:14 ` [PATCH 1/4] xdiff-interface: refactor parsing of merge.conflictstyle Phillip Wood via GitGitGadget
2024-03-08 14:14 ` Phillip Wood via GitGitGadget [this message]
2024-03-08 14:14 ` [PATCH 3/4] merge options: add a conflict style member Phillip Wood via GitGitGadget
2024-03-08 15:46   ` Junio C Hamano
2024-03-08 16:13     ` phillip.wood123
2024-03-08 16:48       ` Junio C Hamano
2024-03-09  4:33         ` Elijah Newren
2024-03-09  5:46           ` Junio C Hamano
2024-03-08 14:14 ` [PATCH 4/4] checkout: cleanup --conflict=<style> parsing Phillip Wood via GitGitGadget
2024-03-08 16:15   ` Junio C Hamano
2024-03-08 16:22     ` phillip.wood123
2024-03-08 21:40       ` Junio C Hamano
2024-03-11 14:36     ` phillip.wood123
2024-03-11 17:41       ` Junio C Hamano
2024-03-12 15:50         ` Phillip Wood
2024-03-08 15:44 ` [PATCH 0/4] checkout: cleanup --conflict= Junio C Hamano
2024-03-08 16:07   ` phillip.wood123
2024-03-14 17:05 ` [PATCH v2 0/5] " Phillip Wood via GitGitGadget
2024-03-14 17:05   ` [PATCH v2 1/5] xdiff-interface: refactor parsing of merge.conflictstyle Phillip Wood via GitGitGadget
2024-03-14 17:19     ` Junio C Hamano
2024-03-14 17:05   ` [PATCH v2 2/5] merge-ll: introduce LL_MERGE_OPTIONS_INIT Phillip Wood via GitGitGadget
2024-03-14 17:05   ` [PATCH v2 3/5] merge options: add a conflict style member Phillip Wood via GitGitGadget
2024-03-14 17:21     ` Junio C Hamano
2024-03-14 17:05   ` [PATCH v2 4/5] checkout: cleanup --conflict=<style> parsing Phillip Wood via GitGitGadget
2024-03-14 17:24     ` Junio C Hamano
2024-03-14 17:05   ` [PATCH v2 5/5] checkout: fix interaction between --conflict and --merge Phillip Wood via GitGitGadget
2024-03-14 17:32     ` Junio C Hamano
2024-03-14 17:07   ` [PATCH v2 0/5] checkout: cleanup --conflict= Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e05bc156bc93e86f3f2ac878c39596bec722a56.1709907270.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.