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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
adf872e783
commit
4fb40c2b82
@ -351,16 +351,13 @@ int ll_merge(mmbuffer_t *result_buf,
|
|||||||
const struct ll_merge_options *opts)
|
const struct ll_merge_options *opts)
|
||||||
{
|
{
|
||||||
static struct git_attr_check check[2];
|
static struct git_attr_check check[2];
|
||||||
|
static const struct ll_merge_options default_opts;
|
||||||
const char *ll_driver_name = NULL;
|
const char *ll_driver_name = NULL;
|
||||||
int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
|
int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
|
||||||
const struct ll_merge_driver *driver;
|
const struct ll_merge_driver *driver;
|
||||||
|
|
||||||
if (!opts) {
|
if (!opts)
|
||||||
struct ll_merge_options default_opts = {0};
|
opts = &default_opts;
|
||||||
return ll_merge(result_buf, path, ancestor, ancestor_label,
|
|
||||||
ours, our_label, theirs, their_label,
|
|
||||||
&default_opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts->renormalize) {
|
if (opts->renormalize) {
|
||||||
normalize_file(ancestor, path);
|
normalize_file(ancestor, path);
|
||||||
|
Loading…
Reference in New Issue
Block a user