Skip to content

Commit 412aff7

Browse files
phillipwoodgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7457014 commit 412aff7

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

builtin/checkout.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int checkout_merged(int pos, const struct checkout *state,
262262
mmbuffer_t result_buf;
263263
struct object_id threeway[3];
264264
unsigned mode = 0;
265-
struct ll_merge_options ll_opts;
265+
struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
266266
int renormalize = 0;
267267

268268
memset(threeway, 0, sizeof(threeway));
@@ -284,7 +284,6 @@ static int checkout_merged(int pos, const struct checkout *state,
284284
read_mmblob(&ours, &threeway[1]);
285285
read_mmblob(&theirs, &threeway[2]);
286286

287-
memset(&ll_opts, 0, sizeof(ll_opts));
288287
git_config_get_bool("merge.renormalize", &renormalize);
289288
ll_opts.renormalize = renormalize;
290289
merge_status = ll_merge(&result_buf, path, &ancestor, "base",

merge-ll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ enum ll_merge_result ll_merge(mmbuffer_t *result_buf,
401401
const struct ll_merge_options *opts)
402402
{
403403
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;
405405
const char *ll_driver_name = NULL;
406406
int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
407407
const struct ll_merge_driver *driver;

merge-ll.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ struct ll_merge_options {
8282
long xdl_opts;
8383
};
8484

85+
#define LL_MERGE_OPTIONS_INIT {0}
86+
8587
enum ll_merge_result {
8688
LL_MERGE_ERROR = -1,
8789
LL_MERGE_OK = 0,

merge-ort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ static int merge_3way(struct merge_options *opt,
19561956
mmbuffer_t *result_buf)
19571957
{
19581958
mmfile_t orig, src1, src2;
1959-
struct ll_merge_options ll_opts = {0};
1959+
struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
19601960
char *base, *name1, *name2;
19611961
enum ll_merge_result merge_status;
19621962

merge-recursive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ static int merge_3way(struct merge_options *opt,
10471047
const int extra_marker_size)
10481048
{
10491049
mmfile_t orig, src1, src2;
1050-
struct ll_merge_options ll_opts = {0};
1050+
struct ll_merge_options ll_opts = LL_MERGE_OPTIONS_INIT;
10511051
char *base, *name1, *name2;
10521052
enum ll_merge_result merge_status;
10531053

0 commit comments

Comments
 (0)