From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Justin Frankel <justin@cockos.com>,
Bert Wesarg <bert.wesarg@googlemail.com>,
git@vger.kernel.org, eyvind.bernhardsen@gmail.com,
Avery Pennarun <apenwarr@gmail.com>
Subject: [PATCH v1.7.4-rc2] ll-merge: simplify opts == NULL case
Date: Sat, 15 Jan 2011 19:08:42 -0600 [thread overview]
Message-ID: <20110116010841.GA18049@burratino> (raw)
In-Reply-To: <7vpqx5mipt.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> + if (!opts) {
>> + struct ll_merge_options default_opts = {0};
>> + return ll_merge(result_buf, path, ancestor, ancestor_label,
>> + ours, our_label, theirs, their_label,
>> + &default_opts);
>
> Fun---expecting tail recursion elimination ;-)?
Fun but not warranted. Let's simplify.
-- 8< --
Subject: 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>
---
ll-merge.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/ll-merge.c b/ll-merge.c
index 007dd3e..6ce512e 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -351,16 +351,13 @@ int ll_merge(mmbuffer_t *result_buf,
const struct ll_merge_options *opts)
{
static struct git_attr_check check[2];
+ static const struct ll_merge_options default_opts;
const char *ll_driver_name = NULL;
int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
const struct ll_merge_driver *driver;
- if (!opts) {
- struct ll_merge_options default_opts = {0};
- return ll_merge(result_buf, path, ancestor, ancestor_label,
- ours, our_label, theirs, their_label,
- &default_opts);
- }
+ if (!opts)
+ opts = &default_opts;
if (opts->renormalize) {
normalize_file(ancestor, path);
--
1.7.4.rc2
next prev parent reply other threads:[~2011-01-16 1:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-23 20:59 [PATCH v2] git-merge: ignore space support Justin Frankel
2010-08-24 2:28 ` Jonathan Nieder
2010-08-24 3:39 ` [RFC/PATCH jn/merge-renormalize] merge-recursive: expose merge options for builtin merge Jonathan Nieder
2010-08-24 18:52 ` Junio C Hamano
2010-08-25 4:29 ` Jonathan Nieder
2010-08-24 4:30 ` [PATCH v2] git-merge: ignore space support Justin Frankel
2010-08-25 4:40 ` Jonathan Nieder
2010-08-25 7:22 ` Bert Wesarg
2010-08-25 15:51 ` Justin Frankel
2010-08-25 17:55 ` Junio C Hamano
2010-08-25 18:21 ` Justin Frankel
2010-08-24 19:01 ` Junio C Hamano
2010-08-24 20:01 ` Bert Wesarg
2010-08-25 3:57 ` Jonathan Nieder
2010-08-26 5:41 ` [PATCH v3 0/4] " Jonathan Nieder
2010-08-26 5:47 ` [PATCH 1/4] merge-recursive: expose merge options for builtin merge Jonathan Nieder
2010-08-26 5:49 ` [PATCH 2/4] ll-merge: replace flag argument with options struct Jonathan Nieder
2010-08-26 16:39 ` Junio C Hamano
2011-01-16 1:08 ` Jonathan Nieder [this message]
2010-08-26 5:50 ` [PATCH 3/4] merge-recursive --patience Jonathan Nieder
2010-08-26 5:51 ` [PATCH 4/4] merge-recursive: options to ignore whitespace changes Jonathan Nieder
2010-08-26 16:39 ` Junio C Hamano
2010-08-27 8:24 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110116010841.GA18049@burratino \
--to=jrnieder@gmail.com \
--cc=apenwarr@gmail.com \
--cc=bert.wesarg@googlemail.com \
--cc=eyvind.bernhardsen@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=justin@cockos.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).