merge-ll: introduce LL_MERGE_OPTIONS_INIT
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Mar 14, 2024 at 17:05 UTC
412aff7b3379b182e3331ec66c0657ae4e39d576
5 files changed
+6
-5
builtin/checkout.c
+1
-2
@@ -262,7 +262,7 @@ static int checkout_merged(int pos, const struct checkout *state,
262
mmbuffer_t result_buf;
263
struct object_id threeway[3];
264
unsigned mode = 0;
265
- struct ll_merge_options ll_opts;
265
+ struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
266
int renormalize = 0;
267
268
memset(threeway, 0, sizeof(threeway));
@@ -284,7 +284,6 @@ static int checkout_merged(int pos, const struct checkout *state,
284
read_mmblob(&ours, &threeway[1]);
285
read_mmblob(&theirs, &threeway[2]);
286
287
- memset(&ll_opts, 0, sizeof(ll_opts));
287
git_config_get_bool("merge.renormalize", &renormalize);
288
ll_opts.renormalize = renormalize;
289
merge_status = ll_merge(&result_buf, path, &ancestor, "base",
merge-ll.c
+1
-1
@@ -401,7 +401,7 @@ enum ll_merge_result ll_merge(mmbuffer_t *result_buf,
401
const struct ll_merge_options *opts)
402
{
403
struct attr_check *check = load_merge_attributes();
404
- static const struct ll_merge_options default_opts;
404
+ static const struct ll_merge_options default_opts = LL_MERGE_OPTIONS_INIT;
405
const char *ll_driver_name = NULL;
406
int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
407
const struct ll_merge_driver *driver;
merge-ll.h
+2
@@ -82,6 +82,8 @@ struct ll_merge_options {
82
long xdl_opts;
83
};
84
85
+#define LL_MERGE_OPTIONS_INIT {0}
86
+
87
enum ll_merge_result {
88
LL_MERGE_ERROR = -1,
89
LL_MERGE_OK = 0,
merge-ort.c
+1
-1
@@ -1956,7 +1956,7 @@ static int merge_3way(struct merge_options *opt,
1956
mmbuffer_t *result_buf)
1957
{
1958
mmfile_t orig, src1, src2;
1959
- struct ll_merge_options ll_opts = {0};
1959
+ struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
1960
char *base, *name1, *name2;
1961
enum ll_merge_result merge_status;
1962
merge-recursive.c
+1
-1
@@ -1047,7 +1047,7 @@ static int merge_3way(struct merge_options *opt,
1047
const int extra_marker_size)
1048
{
1049
mmfile_t orig, src1, src2;
1050
- struct ll_merge_options ll_opts = {0};
1050
+ struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
1051
char *base, *name1, *name2;
1052
enum ll_merge_result merge_status;
1053