Skip to content

Commit 4fb40c2

Browse files
jrngitster
authored andcommitted
ll-merge: simplify opts == NULL case
As long as sizeof(struct ll_merge_options) is small, there is not much reason not to keep a copy of the default merge options in the BSS section. In return, we get clearer code and one less stack frame in the opts == NULL case. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent adf872e commit 4fb40c2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ll-merge.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,13 @@ int ll_merge(mmbuffer_t *result_buf,
351351
const struct ll_merge_options *opts)
352352
{
353353
static struct git_attr_check check[2];
354+
static const struct ll_merge_options default_opts;
354355
const char *ll_driver_name = NULL;
355356
int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
356357
const struct ll_merge_driver *driver;
357358

358-
if (!opts) {
359-
struct ll_merge_options default_opts = {0};
360-
return ll_merge(result_buf, path, ancestor, ancestor_label,
361-
ours, our_label, theirs, their_label,
362-
&default_opts);
363-
}
359+
if (!opts)
360+
opts = &default_opts;
364361

365362
if (opts->renormalize) {
366363
normalize_file(ancestor, path);

0 commit comments

Comments
 (0)