]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge-ll: introduce LL_MERGE_OPTIONS_INIT
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Thu, 14 Mar 2024 17:05:04 +0000 (17:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Mar 2024 17:08:52 +0000 (10:08 -0700)
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>
builtin/checkout.c
merge-ll.c
merge-ll.h
merge-ort.c
merge-recursive.c

index a6e30931b5c809da06c751ba6ef43e47a5a3e0ea..e9859a1980330535deb6c89824da43f1663f09b4 100644 (file)
@@ -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",
index 5ffb045efb9d0f030fcf4a7ce24508a7016f91e5..ef200e449728e36e17e8233cb04636bb1bb78e83 100644 (file)
@@ -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;
index e4a20e81a3aea90b64e65b1f33a38efa595d9a2a..af1ee36abdb38eccb74ad3373ee9c7dd446d8c13 100644 (file)
@@ -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,
index 8617babee41cb59aa5b3dac97a55a53f92e7bc20..4a02c3ecd99590134605abba223b2f528dfd54ff 100644 (file)
@@ -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;
 
index a0c3e7a2d9105dd895f0ae2613d0f87f00b8d794..02b7b584f957d1feec0a4e1a1d644bc5aa7b793e 100644 (file)
@@ -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;